Not able to create Resources using ARM template

Diptesh Kumar 391 Reputation points
2025-04-04T05:05:35.83+00:00

I am using following ARM template, to create RG , ACR and Key vault but failing .

and when I execute below command coming up with following error

PS I:\ARMTemplates\DevOps> az deployment group create --resource-group testrg --template-file I:\ARMTemplates\DevOps\RG-ACR-KV.json --parameters acrName=DACR keyVaultName=DKV

Failed to parse 'I:\ARMTemplates\DevOps\RG-ACR-KV.json', please check whether it is a valid JSON format

User's image

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
      "resourceGroupName": {
        "type": "string"
      },
      "acrName": {
        "type": "string"
      },
      "keyVaultName": {
        "type": "string"
      }
    },
    "resources": [
      {
        "type": "Microsoft.ContainerRegistry/registries",
        "apiVersion": "2019-05-01",
        "name": "[parameters('acrName')]",
        "location": "[resourceGroup().location]",
        "sku": {
          "name": "Basic"
        }
      },
      {
        "type": "Microsoft.KeyVault/vaults",
        "apiVersion": "2019-09-01",
        "name": "[parameters('keyVaultName')]",
        "location": "[resourceGroup().location]",
        "properties": {
          "sku": {
            "family": "A",
            "name": "standard"
          },
          "tenantId": "[subscription().tenantId]",
          "accessPolicies": []
        }
      }
      // Add VNet and other resources similarly
    ]
  }


Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,353 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vinod Pittala 1,750 Reputation points Microsoft External Staff Moderator
    2025-04-08T05:44:17.3433333+00:00

    Hello Varma,

    I have reproduced the issue with your script in our environment, and finally we were able to create a RG, Key vault and ACR.

    Used script for your reference:

    {
        "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
        "contentVersion": "1.0.0.0",
        "parameters": {
          "resourceGroupName": {
            "type": "string"
          },
          "acrName": {
            "type": "string"
          },
          "keyVaultName": {
            "type": "string"
          }
        },
        "resources": [
          {
            "type": "Microsoft.ContainerRegistry/registries",
            "apiVersion": "2019-05-01",
            "name": "[parameters('acrName')]",
            "location": "[resourceGroup().location]",
            "sku": {
              "name": "Basic"
            }
          },
          {
            "type": "Microsoft.KeyVault/vaults",
            "apiVersion": "2019-09-01",
            "name": "[parameters('keyVaultName')]",
            "location": "[resourceGroup().location]",
            "properties": {
              "sku": {
                "family": "A",
                "name": "standard"
              },
              "tenantId": "[subscription().tenantId]",
              "accessPolicies": []
            }
          }
          // Add VNet and other resources similarly
        ]
      }
    

    Please validated the below points before deploying.

    1. The subscription has to be registered with the Resource provider User's image
    2. ACR name should be globally unique with minimum 5 letters. User's image
    3. Key vault should be globally unique.

    Eventual results for your reference.

    User's image

    If you find the answer helps your query, please click upvote it.

    Thanks

    2 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Stanislav Zhelyazkov 27,556 Reputation points MVP Moderator
    2025-04-04T05:20:57.9866667+00:00

    Hi,

    I would check if you are using recent version of az CLI. I believe some older versions did not support comments in JSON. Also properties is required for type Microsoft.ContainerRegistry/registries so it should be added. As my last advise I would suggest using Azure Bicep rather ARM templates. Azure Bicep has a lot of advantages in developing compared to ARM templates.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.