Azure Portal Error: Failed to start virtual machine 'xxxx'. Error: The Key Vault secret referenced with the URL 'xxxx' does not exist

↘锁芯ラ 提交于 2021-02-10 04:09:59

问题


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.


回答1:


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.




回答2:


I was able to recover multiple deleted vaults using Azure CLI. At the moment Azure keeps the deleted vault for 90 days.

Azure CLI version: 2.0.68

Command: az keyvault recover --location "your vault location" --resource-group "your vault resource group" --name "your vault name"




回答3:


I would suggest you re-creating the VM with the existing VHD file.

I reproduce the same error in my lab. When I try to re-upload the certificate, I find that the GUID of this certificate has been changed. So we need to edit the configuration of the VM.

Then I find that the "windowsConfiguration.winRM.listeners" property can not be changed if the VM has been deployed. Therefore, in conclusion, you may need to recreate your VM with the same VHD file.



来源:https://stackoverflow.com/questions/39638225/azure-portal-error-failed-to-start-virtual-machine-xxxx-error-the-key-vault

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!