Add SSL Cert to an existing VM linux vm from Azure key vault

前端 未结 2 421
离开以前
离开以前 2021-01-17 05:47

How you add SSL Cert to an existing azure Linux VM from Azure Key vault. for windows we use the following command

$vaultId=(Get-AzureRmKeyVault -ResourceGro         


        
2条回答
  •  被撕碎了的回忆
    2021-01-17 06:18

    You could use Azure Cli to do this. Using following command.

    secret=$(az keyvault secret list-versions \
              --vault-name $keyvault_name \
              --name mycert \
              --query "[?attributes.enabled].id" --output tsv)
    vm_secret=$(az vm format-secret --secret "$secret")
    
    az vm update -n shui -g shuikeyvault --set osProfile.secrets="$vm_secret"
    

    Then the certificate stores on /var/lib/waagent, you could use Azure Custom Script to use it.

    Note: You should use "$vm_secret", I test in my lab, only $vm_secret does not work for me.

提交回复
热议问题