azureazure-virtual-machineazure-vmazure-disk

Azure CLI - How to Update Disk Encryption Settings


For some reason, after resizing my VM, my disk started to point to a Key Vault that does not exist.

I need to update the "secretUrl" and the "sourceVault.id", and I've created a new Key Vault for it, however, I'm not being able to update it using azure cli (az disk...)

Using the "az disk list" I was able to collect the image presented below.

enter image description here


Solution

  • SOLVED: You just have to run the following command:

    az disk update --name MyDisk --resource-group MyResourceGroup --set encryptionSettingsCollection.encryptionSettings='[{"diskEncryptionKey": {"secretUrl": "https:///secrets//","sourceVault": {"id": "/subscriptions/MySubscription/resourceGroups/MyResourceGroup/providers/Microsoft.KeyVault/vaults/MyVault"}},"keyEncryptionKey": null}]'