Upravit

Sdílet prostřednictvím


Update-AzCosmosDBMongoDBRoleDefinition

Update an existing CosmosDB MongoDB Role Definition.

Syntax

Update-AzCosmosDBMongoDBRoleDefinition
      -Id <String>
      -RoleName <String>
      -Type <String>
      -DatabaseName <String>
      -Privileges <PSMongoPrivilege[]>
      [-Roles <PSMongoRole[]>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzCosmosDBMongoDBRoleDefinition
      -ResourceGroupName <String>
      -AccountName <String>
      -Id <String>
      -RoleName <String>
      -Type <String>
      -DatabaseName <String>
      -Privileges <PSMongoPrivilege[]>
      [-Roles <PSMongoRole[]>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzCosmosDBMongoDBRoleDefinition
      -Id <String>
      -RoleName <String>
      -Type <String>
      -DatabaseName <String>
      -Privileges <PSMongoPrivilege[]>
      [-Roles <PSMongoRole[]>]
      -DatabaseAccountObject <PSDatabaseAccountGetResults>
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzCosmosDBMongoDBRoleDefinition
      -Id <String>
      -RoleName <String>
      -Type <String>
      -DatabaseName <String>
      -Privileges <PSMongoPrivilege[]>
      [-Roles <PSMongoRole[]>]
      -DatabaseAccountObject <PSDatabaseAccountGetResults>
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzCosmosDBMongoDBRoleDefinition
      -Id <String>
      -RoleName <String>
      -Type <String>
      -DatabaseName <String>
      -Privileges <PSMongoPrivilege[]>
      [-Roles <PSMongoRole[]>]
      [-ResourceId <String>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

Update an existing 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


Update-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
Update-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}

Example 3: InputObject

$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
$RoleDef = Get-AzCosmosDBMongoDBRoleDefinition -AccountName accountName -ResourceGroupName resourceGroupName -Id id

Update-AzCosmosDBMongoDBRoleDefinition `
	-Id id `
	-Type CustomRole `
	-RoleName roleName `
	-Privileges $Privilege `
	-Roles $Roles `
	-InputObject $RoleDef

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.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DatabaseAccountObject

Role definition object.

Type:PSDatabaseAccountGetResults
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-DatabaseName

Database Name for the MongoDB Role Definition.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Id

Role Definition Unique Id(Format is <databaseName>.<roleName>).

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Privileges

Set of Privileges for CosmosDB MongoDB API.

Type:PSMongoPrivilege[]
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

Name of resource group.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ResourceId

ResourceId of the resource.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RoleName

Role Definition Name.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Roles

Set of inherited roles for CosmosDB MongoDB API Role Definition.

Type:PSMongoRole[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Type

Type of Role Definition, either CustomRole or BuiltInRole. Default value is CustomRole.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

Microsoft.Azure.Commands.CosmosDB.Models.PSMongoDBRoleDefinitionGetResults