Create (grant) a Microsoft Entra ID principal access to a mongo cluster by assigning it
database roles.
The '-Type' parameter surfaces the Entra principal type; the service models
the identity provider as a discriminated union (identityProvider -> microsoftEntraID ->
principalType) that the generated cmdlet does not flatten, so this wrapper exposes a simple
'-Type' flag and builds the nested request body.
Examples
Example 1: Assign a Microsoft Entra ID user to a mongo cluster
New-AzDocumentDBUser -Name 00000000-0000-0000-0000-000000000000 -MongoClusterName myCluster -ResourceGroupName myResourceGroup `
-Type User -Role @(@{ Db = 'admin'; Role = 'root' })
Name ProvisioningState
---- -----------------
00000000-0000-0000-0000-000000000000 Succeeded
Grant a Microsoft Entra ID principal data-plane access to a mongo cluster.
-Name is
the object id of the Entra principal, -Type is the principal type (User or
ServicePrincipal), and -Role assigns one or more database roles.
Microsoft Entra
authentication must be enabled on the cluster (see -AuthConfigAllowedMode on
New-AzDocumentDBMongoCluster).
The DefaultProfile parameter is not functional.
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters.