New-AzCosmosDBMongoDBRoleDefinition
Creates a new CosmosDB MongoDB Role Definition.
Syntax
ByFieldsDataActionsParameterSet (Default)
New-AzCosmosDBMongoDBRoleDefinition
-Id <String>
-RoleName <String>
-Type <String>
-DatabaseName <String>
-Privileges <PSMongoPrivilege[]>
[-Roles <PSMongoRole[]>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByNameParameterSet
New-AzCosmosDBMongoDBRoleDefinition
-ResourceGroupName <String>
-AccountName <String>
-Id <String>
-RoleName <String>
-Type <String>
-DatabaseName <String>
-Privileges <PSMongoPrivilege[]>
[-Roles <PSMongoRole[]>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByParentObjectDataActionsParameterSet
New-AzCosmosDBMongoDBRoleDefinition
-Id <String>
-RoleName <String>
-Type <String>
-DatabaseName <String>
-Privileges <PSMongoPrivilege[]>
-DatabaseAccountObject <PSDatabaseAccountGetResults>
[-Roles <PSMongoRole[]>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByParentObjectPermissionsParameterSet
New-AzCosmosDBMongoDBRoleDefinition
-Id <String>
-RoleName <String>
-Type <String>
-DatabaseName <String>
-Privileges <PSMongoPrivilege[]>
-DatabaseAccountObject <PSDatabaseAccountGetResults>
[-Roles <PSMongoRole[]>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByResourceIdParameterSet
New-AzCosmosDBMongoDBRoleDefinition
-Id <String>
-RoleName <String>
-Type <String>
-DatabaseName <String>
-Privileges <PSMongoPrivilege[]>
[-Roles <PSMongoRole[]>]
[-ResourceId <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Creates a new CosmosDB MongoDB Role Definition.
In order to specify the Role Definition's Privileges, use the New-AzCosmosDBMongoDBPrivilege cmdlet to create PSMongoPrivilege objects to pass in through the Privileges parameter.
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
$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 `
-AccountName accountName `
-ResourceGroupName resourceGroupName `
-DatabaseName test `
-Id id `
-Type CustomRole `
-RoleName roleName `
-Privileges $Privilege `
-Roles $Roles
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}
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
-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
-Privileges
Set of Privileges for CosmosDB MongoDB API.
Parameter properties
Type: PSMongoPrivilege [ ]
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
-RoleName
Role Definition Name.
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
-Roles
Set of inherited roles for CosmosDB MongoDB API Role Definition.
Parameter properties
Type: PSMongoRole [ ]
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
-Type
Type of Role Definition, either CustomRole or BuiltInRole.
Default value is CustomRole.
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