Deployment template validation failed while deploying machine in azure

155 views Asked by At

Facing following issues while performing vagrant up with azure provider

"response": {
    "body": "{\"error\":{\"code\":\"InvalidTemplate\",\"message\":\"Deployment template validation failed: 'The value fo
r the template parameter 'adminPassword' at line '1' and column '306' is not provided. Please see https://aka.ms/arm-dep
loy/#parameter-file for usage details.'.\"}}",

Template file:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "vaults_VaultVagrant_name": {
      "defaultValue": "VaultVagrant",
      "type": "String"
    },
    "AdminPassword":{
    "type":"securestring"
    }

  },
  "variables": {},
  "resources": [
    {
      "type": "Microsoft.KeyVault/vaults",
      "name": "[parameters('vaults_VaultVagrant_name')]",
      "apiVersion": "2015-06-01",
      "location": "eastus",
      "tags": {},
      "properties": {
        "sku": {
          "family": "A",
          "name": "standard"
        },
        "tenantId": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
        "accessPolicies": [
          {
            "tenantId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
            "objectId": "1efb1891-8ad4-4f69-9e0d-f5849e6f8c98",
            "permissions": {
              "keys": [
                "get",
                "create",
                "delete",
                "list",
                "update",
                "import",
                "backup",
                "restore"
              ],
              "secrets": [
                "all"
              ]
            }
          }
        ],
        "enabledForDeployment": true
      },
      "resources": [],
      "dependsOn": []
    }

  ]
}

Parameter

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "AdminPassword": {
            "reference": {
               "keyVault": {
                  "id":"/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/azurevag/providers/Microsoft.KeyVault/vaults/VaultVagrant"
               }, 
               "secretName": "vagrant" 
            }   
        }
   }
}

I am deploying both files from local machine as like in below

azure group deployment create -f "c:\MyTemplates\example.json" -e "c:\MyTemplates\example.params.json" -g examplegroup -n exampledeployment

ISSUE:After deployment is successfully created checked the deployment script in azure portal where both the files look like below

TemplateFile

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "vaults_VaultVagrant_name": {
      "defaultValue": "VaultVagrant",
      "type": "String"
    }
  },
  "variables": {},
  "resources": [
    {
      "comments": "Generalized from resource: '/subscriptions/214d050d-5430-4fd8-bb08-8152128a07b9/resourceGroups/azurevag/providers/Microsoft.KeyVault/vaults/VaultVagrant'.",
      "type": "Microsoft.KeyVault/vaults",
      "name": "[parameters('vaults_VaultVagrant_name')]",
      "apiVersion": "2015-06-01",
      "location": "eastus",
      "tags": {},
      "properties": {
        "sku": {
          "family": "A",
          "name": "standard"
        },
        "tenantId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "accessPolicies": [
          {
            "tenantId": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
            "objectId": "1efb1891-8ad4-4f69-9e0d-f5849e6f8c98",
            "permissions": {
              "keys": [
                "get",
                "create",
                "delete",
                "list",
                "update",
                "import",
                "backup",
                "restore"
              ],
              "secrets": [
                "all"
              ]
            }
          }
        ],
        "enabledForDeployment": true
      },
      "resources": [],
      "dependsOn": []
    }
  ]
}

Note: Parameter adminpassword is missed after deployment

Parameter file:

parameter file is empty. How the values(admin password) are missed after deployment?

0

There are 0 answers