在azure

时间:2017-01-10 06:02:41

标签: json azure deployment vagrant vagrant-windows

使用azure提供程序执行vagrant时遇到以下问题

"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.'.\"}}",

模板文件:

{
  "$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": []
    }

  ]
}

参数

{
  "$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" 
            }   
        }
   }
}

我正在从本地计算机部署这两个文件,如下所示

  

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

问题:成功创建部署后,检查azure门户中的部署脚本,其中两个文件如下所示

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": []
    }
  ]
}

注意:部署后错过参数adminpassword

参数文件:

参数文件为空。 部署后如何丢失值(管理员密码)?

0 个答案:

没有答案