I have deleted some Key Vaults from my resource manager after assuming that they are not used anywhere in my configuration and that those were some leftovers from my testing. Now I can't start my virtual machines and this error message appears.
Failed to start virtual machine 'xxxx'. Error: The Key Vault secret referenced with the URL 'xxxx' does not exist.
Could you please advise me how to put my virtual machines back on track since I can't afford the time building them again?
Thanks a lot.
I had a similar issue except my SSL certificate needed to be renewed. If you use https://resources.azure.com, you can see the old URL listed in the secrets property of the osProfile.
I couldn't update the new vault certificate with my ARM template so I had to fix it with Powershell first. This removes the old vault so my template could add the new one.
$vaultName = "<your vault name>"
$vmName = "<your vm name>"
$rg = "<your resource group>"
$vaultId = (Get-AzKeyVault -VaultName $vaultName).ResourceId
$vm = Get-AzVM -ResourceGroupName $rg -Name $vmName
Remove-AzVMSecret -VM $vm -SourceVaultId $vaultId
Update-AzVM -ResourceGroupName $rg -VM $vm
This worked for me so I wanted to document it in case it helps somebody else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With