Created
July 10, 2024 23:37
-
-
Save RylandDeGregory/af5cb52357e31d7cc231cdf49470be18 to your computer and use it in GitHub Desktop.
Add an Azure Cosmos DB NoSQL Data Plane Role Assignment using Azure PowerShell.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $RoleDefinitions = @( | |
| @{ | |
| Name = 'Cosmos DB Built-in Data Reader' | |
| Id = '00000000-0000-0000-0000-000000000001' | |
| } | |
| @{ | |
| Name = 'Cosmos DB Built-in Data Contributor' | |
| Id = '00000000-0000-0000-0000-000000000002' | |
| } | |
| ) | |
| $RoleDefinitionId = $RoleDefinitions | Where-Object { $_.Name -like '*Contributor' } | Select-Object -ExpandProperty Id | |
| $ResourceGroupName = '' | |
| $AccountName = '' | |
| $PrincipalId = '' | |
| $CosmosDBParams = @{ | |
| AccountName = $AccountName | |
| PrincipalId = $PrincipalId | |
| ResourceGroupName = $ResourceGroupName | |
| RoleDefinitionId = $RoleDefinitionId | |
| Scope = '/' | |
| } | |
| New-AzCosmosDBSqlRoleAssignment @CosmosDBParams |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment