New-AzCosmosDBMongoDBUserDefinition
Creates a new CosmosDB MongoDB User Definition.
Syntax
ByFieldsDataActionsParameterSet (Default)
New-AzCosmosDBMongoDBUserDefinition
-Id <String>
-UserName <String>
-Password <String>
-DatabaseName <String>
-Roles <System.Collections.Generic.List`1[Microsoft.Azure.PowerShell.Cmdlets.CosmosDB.Models.MongoDB.PSMongoRole]>
[-Mechanisms <String>]
[-CustomData <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByNameParameterSet
New-AzCosmosDBMongoDBUserDefinition
-ResourceGroupName <String>
-AccountName <String>
-Id <String>
-UserName <String>
-Password <String>
-DatabaseName <String>
-Roles <System.Collections.Generic.List`1[Microsoft.Azure.PowerShell.Cmdlets.CosmosDB.Models.MongoDB.PSMongoRole]>
[-Mechanisms <String>]
[-CustomData <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByParentObjectDataActionsParameterSet
New-AzCosmosDBMongoDBUserDefinition
-Id <String>
-UserName <String>
-Password <String>
-DatabaseName <String>
-Roles <System.Collections.Generic.List`1[Microsoft.Azure.PowerShell.Cmdlets.CosmosDB.Models.MongoDB.PSMongoRole]>
-DatabaseAccountObject <PSDatabaseAccountGetResults>
[-Mechanisms <String>]
[-CustomData <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByParentObjectPermissionsParameterSet
New-AzCosmosDBMongoDBUserDefinition
-Id <String>
-UserName <String>
-Password <String>
-DatabaseName <String>
-Roles <System.Collections.Generic.List`1[Microsoft.Azure.PowerShell.Cmdlets.CosmosDB.Models.MongoDB.PSMongoRole]>
-DatabaseAccountObject <PSDatabaseAccountGetResults>
[-Mechanisms <String>]
[-CustomData <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByResourceIdParameterSet
New-AzCosmosDBMongoDBUserDefinition
-Id <String>
-UserName <String>
-Password <String>
-DatabaseName <String>
-Roles <System.Collections.Generic.List`1[Microsoft.Azure.PowerShell.Cmdlets.CosmosDB.Models.MongoDB.PSMongoRole]>
[-Mechanisms <String>]
[-CustomData <String>]
[-ResourceId <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Creates a new CosmosDB MongoDB User Definition.
In order to specify the Role Definition's Roles, use the New-AzCosmosDBMongoDBRole cmdlet to create PSMongoRole objects to pass in through the Roles parameter.
Examples
Example 1: Default
$Roles = New-AzCosmosDBMongoDBRole -Database test -Role roleName
New-AzCosmosDBMongoDBUserDefinition `
-AccountName accountName `
-ResourceGroupName resourceGroupName `
-DatabaseName 'test' `
-UserName 'myName' `
-Password 'pass' `
-Id id `
-Mechanisms 'SCRAM-SHA-256' `
-CustomData 'test' `
-Roles $Roles
Id : /subscriptions/80be3961-0521-4a0a-8570-5cd5a4e2f98c/resourceGroups/mongorbactest02/providers/Microsoft.DocumentDB/databaseAccounts/ashwini001/mongodbUserDefinitions/test.testuser1
UserName : testuser1
Password :
Mechanisms : SCRAM-SHA-256
DatabaseName : test
CustomData :
Roles : {Microsoft.Azure.Management.CosmosDB.Models.Role}
Example 2: ParentObject
$DatabaseAccount = Get-AzCosmosDBAccount -Name accountName -ResourceGroupName resourceGroupName
$Actions = 'insert', 'find'
$PrivilegeResource = New-AzCosmosDBMongoDBPrivilegeResource -Database test -Collection test
$Privilege = New-AzCosmosDBMongoDBPrivilege -PrivilegeResource $PrivilegeResource -Actions $Actions
$Roles = New-AzCosmosDBMongoDBRole -Database test -Role roleName
New-AzCosmosDBMongoDBRoleDefinition `
-Id id `
-Type CustomRole `
-RoleName roleName `
-Privileges $Privilege `
-Roles $Roles `
-DatabaseAccountObject $DatabaseAccount
Id : /subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/accountName/mongodbRoleDefinitions/id
RoleName : roleName
Type : CustomRole
DatabaseName : test
Privileges : {Microsoft.Azure.Management.CosmosDB.Models.Privilege}
Roles : {Microsoft.Azure.Management.CosmosDB.Models.Role, Microsoft.Azure.Management.CosmosDB.Models.Role}
Parameters
-AccountName
Name of the Cosmos DB database account.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ByNameParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: SwitchParameter
Default value: False
Supports wildcards: False
DontShow: False
Aliases: cf
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-CustomData
Additional information about the user Definition.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DatabaseAccountObject
Role definition object.
Parameter properties
Parameter sets
ByParentObjectDataActionsParameterSet
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
ByParentObjectPermissionsParameterSet
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
-DatabaseName
Database Name for the MongoDB Role Definition.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
Type: IAzureContextContainer
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzContext, AzureRmContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Id
Role Definition Unique Id(Format is <databaseName>.<roleName>
).
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Mechanisms
Password for the user Definition.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Password
Password for the user Definition.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ResourceGroupName
Name of resource group.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ByNameParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ResourceId
ResourceId of the resource.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ByResourceIdParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Roles
Set of inherited roles for CosmosDB MongoDB API Role Definition.
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-UserName
Unique username(per database) for the user Definition.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Parameter properties
Type: SwitchParameter
Default value: False
Supports wildcards: False
DontShow: False
Aliases: wi
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
CommonParameters
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 .
Outputs
Microsoft.Azure.Commands.CosmosDB.Models.PSMongoDBRoleDefinitionGetResults