Skip to content

Migrating ProAuth 2.x role assignments to 3.x ​

ProAuth 3.x replaces the V1 role model — ProAuthUserRole, ProAuthGroupRole, ClientAppRole rows keyed off the ProAuthSecurityRole enum — with the unified V2 model based on ProAuthRoleAssignment, named system roles, and the scope grammar documented in RBAC v2.

This page is the operations playbook for that migration.

What changes ​

AspectV1V2
StorageProAuthUserRole / ProAuthGroupRole / ClientAppRole tablesProAuthRoleAssignment table
Role identityProAuthSecurityRole enum (SystemAdmin=1, ...)Named roles (system.admin, system.tenant-admin, ...)
ScopeApplyToTenantId / ApplyToIdpInstanceId columnsScope path string (/customer:.../subscription:...)
PrincipalImplicit (one row type per principal kind)Explicit PrincipalType enum (User, Group, ServicePrincipal)
MutabilityMutableImmutable — delete + recreate to re-scope

Upgrading a ProAuth 2.x SQL Server database ​

This applies whether the installation started on 2.x or was upgraded to 2.x from an earlier version. Follow the database bridge prerequisites and deployment order. Keep the application and all writers offline until the bridge and initialization jobs finish.

On a fresh bridge, proauthcli migrate v2tov3 creates the eight system role records needed by the foreign keys, translates the old grants, and records completion in the same core database transaction as the v3 baseline. Initialization then reconciles the system role definitions and permissions and ensures the deployment client's grant. Ordinary v3 upgrades never replay retained role tables.

A grant keeps its original ProAuth user, group, or client ID. Group grants remain on groups, including grants inherited through nested groups. UserStore synchronization continues to reconcile its own groups and preserves independently managed group memberships. The conversion does not change memberships, enable accounts, or link identities. Duplicate grants produce one assignment. New assignments have audit and concurrency metadata and identify their legacy source row.

Legacy roleV3 roleScope
SystemAdmin (1)system.adminGlobal
CustomerAdmin (2)system.customer-adminCustomer that owns the principal's subscription
SubscriptionAdmin (4)system.subscription-adminPrincipal's subscription
TenantAdmin (8)system.tenant-adminNamed tenant, under its subscription and customer
UserStoreAdmin (16)system.userstore-adminNamed UserStore provider, under its subscription and customer
UserAdmin (32)system.user-self-serviceGlobal path; the role's permissions are restricted to the caller's own records
ApplicationDataReader (64)system.application-data-readerSubscription, never global
AuditTrailReader (128)system.audit-trail-readerGlobal audit access

Undefined (0) grants no access. An unknown or combined value, ambiguous principal, missing target or incomplete hierarchy stops a fresh bridge and rolls back its core transaction. The error identifies the source row. Correct or explicitly retire the invalid grant before retrying. V2 could derive an application reader's subscription from the caller: a group spanning subscriptions or a cross-subscription client does not have one equivalent static grant. Review its intended subscriptions and explicitly assign those scopes in v3; do not substitute a global role.

Recovery after an earlier bridge ​

If you already ran a bridge that did not translate grants, do not rerun it for role recovery. A missing assignment might have been deliberately revoked. One working deployment client, or an Admin App showing only Start, does not tell you which other grants should exist.

  1. Back up the core database. Schedule downtime, stop all ProAuth instances and writers, and keep them stopped from preview through apply. This database operation runs before restarting the permission caches. Use a current CLI with database migration privileges.

  2. Preview the retained roles without modifying the database:

    sh
    proauthcli migrate recover-v2-role-assignments --connectionstring "$CONNECTION_STRING"

    Each entry includes the source ID, principal kind (0 user, 1 group, 2 client), principal ID, enabled state, role, scope and disposition. Present includes manual repairs under another assignment ID. An ID or provenance conflict indicates an existing grant with different semantics; the command will not overwrite it. Investigate conflicts and unresolved rows separately.

  3. Compare Missing entries with your approved access records and changes since the upgrade. Save only the fingerprints of approved entries in a JSON array, for example ["<64-character fingerprint from the preview>"]. Keep the preview and decisions with the change record. A disabled principal stays disabled; review whether its grant is still intended if it is re-enabled.

  4. Apply the reviewed selection once:

    sh
    proauthcli migrate recover-v2-role-assignments --connectionstring "$CONNECTION_STRING" --approved-file approved.json

    A stale or unrecognized selection fails atomically. A successful apply records completion, including when the operator explicitly chooses []. Unselected grants stay absent. Repeating the command after completion cannot restore a later revocation. Use normal v3 role administration for subsequent changes.

Inspect the completion record in the core database:

sql
SELECT value FROM sys.extended_properties
WHERE class = 0 AND name = 'ProAuth.LegacyRoleAssignments.v1';

Verify effective access ​

Restart the application after deployment. Sign in to the Admin App with an affected account and a fresh session. Verify that the authenticated subject identifies the expected ProAuthUser.Id, and check the role assignments for that ID and its groups. For client credentials, check the client application's ID. Do not infer identity from an email address or copy a grant to a similarly named account. Earlier versions could look across user records using federated identifiers; verify the provider instance, external subject and subscription before resolving discrepancies.

Check an expected navigation item and perform an authorized scoped API operation. Repeat the operation against an unrelated tenant or subscription and verify that it is denied or the record is filtered out. Check a disabled account cannot sign in. Raw row counts do not establish effective access.

Backwards compatibility ​

The V1 REST controllers (ProAuthUserRole, ProAuthGroupRole, ClientAppRole) are preserved and now operate as adapters over the V2 store. Reads project from ProAuthRoleAssignment back into the V1 DTO shape; writes are translated into a V2 assignment via RoleAssignmentMapper.

This means:

  • V1 clients keep working with no changes.
  • A V1 write is immediately visible to V2 readers and vice versa.
  • The V1 surface is frozen — new permissions, scopes, and principal types are only addressable through V2.