skip to Main Content

When I create a keyvault with azure portal, before actual creating I have a link called "View Automation Template":
enter image description here

Where inside I can see a keyvault ARM template, but as I can see the azure cli command az keyvault create .. doesn’t support options like --template-file or --parameters. How can I deploy the ARM template from the portal via azure CLI?

2

Answers


  1. Where inside I can see a keyvault ARM template, but as I can see the azure cli command az keyvault create .. doesn’t support options like --template-file or --parameters

    Yes, You can deploy ARM template via azure CLI to create Azure Keyvault.

    I have followed this MS Doc to create Azure Keyvault with ARM Template.

    Azure CLI Command

    New-AzResourceGroupDeployment -ResourceGroupName "ResourceGroup-Name" TemplateFile .ARM.json
    

    Note: If you are running the command from the same directory, you can provide the template file as .<JSON File>

    Output:

    enter image description here

    If you want to use the -TemplateParameterFile option, you can create a parameter file separately in the same directory and use the command as shown below.

    New-AzResourceGroupDeployment -ResourceGroupName "ResourceGroup Name" TemplateFile .ARM.json -TemplateParameterFile .vault.parameters.json
    

    Reference: Create an Azure Key Vault using an ARM template

    Login or Signup to reply.
  2. The CLI command you are looking for is az deployment group create which makes use of an ARM template and parameters to deploy that template in a resource group.

    You would use az keyvault create when you want to create a KeyVault resource by directly specifying its properties as command parameters instead of using an ARM template and parameters.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search