Created
August 28, 2021 15:25
-
-
Save timothywarner/cbcd9262cd91a04d283bb958b5ca8874 to your computer and use it in GitHub Desktop.
Regenerate your Cosmos DB primary read/write key with 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
| $resourceGroupName = "cosmos-rg" | |
| $cosmosAccountName = "cosmos-acct-name" | |
| # See current primary rw key value for reference | |
| (Get-AzCosmosDBAccountKey -ResourceGroupName $resourceGroupName -Name $cosmosAccountName).PrimaryMasterKey | |
| # Regenerate Cosmos account's primary read/write key | |
| New-AzCosmosDBAccountKey -ResourceGroupName $resourceGroupName -Name $cosmosAccountName -KeyKind "primary" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment