github.com/marksheahan/packer@v0.10.2-0.20160613200515-1acb2d6645a0/builder/azure/arm/template.go (about)

     1  // Copyright (c) Microsoft Corporation. All rights reserved.
     2  // Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
     3  
     4  package arm
     5  
     6  // See https://github.com/Azure/azure-quickstart-templates for a extensive list of templates.
     7  
     8  // Template to deploy a KeyVault.
     9  //
    10  // This template is still hard-coded unlike the ARM templates used for VMs for
    11  // a couple of reasons.
    12  //
    13  //  1. The SDK defines no types for a Key Vault
    14  //  2. The Key Vault template is relatively simple, and is static.
    15  //
    16  const KeyVault = `{
    17    "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
    18    "contentVersion": "1.0.0.0",
    19    "parameters": {
    20      "keyVaultName": {
    21        "type": "string"
    22      },
    23      "keyVaultSecretValue": {
    24        "type": "securestring"
    25      },
    26      "objectId": {
    27       "type": "string"
    28      },
    29      "tenantId": {
    30        "type": "string"
    31      }
    32    },
    33    "variables": {
    34      "apiVersion": "2015-06-01",
    35      "location": "[resourceGroup().location]",
    36      "keyVaultSecretName": "packerKeyVaultSecret"
    37    },
    38    "resources": [
    39      {
    40        "apiVersion": "[variables('apiVersion')]",
    41        "type": "Microsoft.KeyVault/vaults",
    42        "name": "[parameters('keyVaultName')]",
    43        "location": "[variables('location')]",
    44        "properties": {
    45          "enabledForDeployment": "true",
    46          "enabledForTemplateDeployment": "true",
    47          "tenantId": "[parameters('tenantId')]",
    48          "accessPolicies": [
    49            {
    50              "tenantId": "[parameters('tenantId')]",
    51              "objectId": "[parameters('objectId')]",
    52              "permissions": {
    53                "keys": [ "all" ],
    54                "secrets": [ "all" ]
    55              }
    56            }
    57          ],
    58          "sku": {
    59            "name": "standard",
    60            "family": "A"
    61          }
    62        },
    63        "resources": [
    64          {
    65            "apiVersion": "[variables('apiVersion')]",
    66            "type": "secrets",
    67            "name": "[variables('keyVaultSecretName')]",
    68            "dependsOn": [
    69              "[concat('Microsoft.KeyVault/vaults/', parameters('keyVaultName'))]"
    70            ],
    71            "properties": {
    72              "value": "[parameters('keyVaultSecretValue')]"
    73            }
    74          }
    75        ]
    76      }
    77    ]
    78  }`