Skip to content

Instantly share code, notes, and snippets.

@timothywarner
Created August 28, 2021 15:25
Show Gist options
  • Select an option

  • Save timothywarner/cbcd9262cd91a04d283bb958b5ca8874 to your computer and use it in GitHub Desktop.

Select an option

Save timothywarner/cbcd9262cd91a04d283bb958b5ca8874 to your computer and use it in GitHub Desktop.
Regenerate your Cosmos DB primary read/write key with Azure PowerShell
$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