Tim Warner
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" |
- Short link to this Gist: timw.info/bicep2022
- Tim's website
- Tim's Twitter
- Tim's "Frankenstein" repository
Prepared for the OnRamp program at the PowerShell + DevOps Global Summit 2022 (April 25-28 2022)
Author: Tim Warner
Start a Individual Premium Free Trial to gain access to the training.
// Policy assignments and information about each of its respective definitions
// Gets policy assignments in your environment with the respective assignment name,definition associated, category of definition (if applicable), as well as whether the definition type is an initiative or a single policy.
policyResources
| where type =~'Microsoft.Authorization/PolicyAssignments'
| project policyAssignmentId = tolower(tostring(id)), policyAssignmentDisplayName = tostring(properties.displayName), policyAssignmentDefinitionId = tolower(properties.policyDefinitionId)
| join kind=leftouter(
policyResources
| where type =~'Microsoft.Authorization/PolicySetDefinitions' or type =~'Microsoft.Authorization/PolicyDefinitions'