Skip to content

Instantly share code, notes, and snippets.

@ShridharParameshwarBhat
Created October 20, 2021 11:41
Show Gist options
  • Save ShridharParameshwarBhat/ebe93615f89b2ffe7b779b2c7b951b72 to your computer and use it in GitHub Desktop.
Save ShridharParameshwarBhat/ebe93615f89b2ffe7b779b2c7b951b72 to your computer and use it in GitHub Desktop.
Update VM
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string",
"metadata": {
"description": "Name of the virtual machine"
}
},
"keyVaultName": {
"type": "string",
"metadata": {
"description": "Name of the KeyVault to place the volume encryption key"
}
},
"keyVaultResourceGroup": {
"type": "string",
"metadata": {
"description": "Resource group of the KeyVault"
}
},
"keyVaultSecretUrl": {
"type": "string",
"metadata": {
"description": "SecretUrl of keyvault"
}
},
"keyEncryptionKeyURL": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "URL of the KeyEncryptionKey used to encrypt the volume encryption key"
}
}
},
"variables": {
"keyVaultURL": "[concat('https://', parameters('keyVaultName'), '.vault.azure.net/')]",
"keyVaultResourceID": "[concat(subscription().id,'/resourceGroups/',parameters('keyVaultResourceGroup'),'/providers/Microsoft.KeyVault/vaults/', parameters('keyVaultName'))]"
},
"resources": [
{
"name": "updatevm",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[if(equals(parameters('useExistingKek'), 'nokek'), 'https://gist.githubusercontent.com/ShridharParameshwarBhat/b1472d88e7cda8b193d5f7dfd272f341/raw/f3dc57e00bf9971a384b58162aadecad46fe85a3/clientcertnokek.json', 'https://gist.githubusercontent.com/ShridharParameshwarBhat/869405ea68593c8ccca2c8ea1b9537e6/raw/2380a0a5d7f8e2cd6c27c286a1ef082910e28cb8/clientcertusekek.json')]",
"contentVersion": "1.0.0.0"
},
"parameters": {
"vmName": {
"value": "[parameters('vmName')]"
},
"keyVaultResourceID": {
"value": "[variables('keyVaultResourceID')]"
},
"keyVaultSecretUrl": {
"value": "[parameters('keyVaultSecretUrl')]"
},
"keyEncryptionKeyURL": {
"value": "[parameters('keyEncryptionKeyURL')]"
}
}
}
}
],
"outputs": {
"BitLockerKey": {
"type": "string",
"value": "[reference(resourceId('Microsoft.Compute/virtualMachines/extensions', parameters('vmName'), variables('extensionName'))).instanceView.statuses[0].message]"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment