Hello EnterpriseArchitect,
Thanks for reaching out to MS Q&A. I can help you with fixing your issues.
Here's a high-level PowerShell script idea to automate this,
Note: Test in a non-prod environment before using in a prod environment.
# Connect to Azure
Connect-AzAccount
# Get all Key Vaults in all subscriptions (or scope to one if needed)
$subscriptions = Get-AzSubscription
foreach ($sub in $subscriptions) {
Set-AzContext -SubscriptionId $sub.Id
$vaults = Get-AzKeyVault
foreach ($vault in $vaults) {
if ($vault.EnableRbacAuthorization -eq $false) {
Write-Host "Migrating Key Vault: $($vault.VaultName) in $($vault.ResourceGroupName)"
# Enable RBAC (irreversible)
Update-AzKeyVault -VaultName $vault.VaultName -ResourceGroupName $vault.ResourceGroupName -EnableRbacAuthorization $true
}
}
}
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Siri