title: ARM template keyvault accesspolicies inside object parameter
body: <p>When i deploy my ARM template for the azure keyvault I got this error message.</p>
  
  <pre><code> "error": {
      "code": "BadRequest",
      "message": "An invalid value was provided for 'accessPolicies'."
    }
  </code></pre>
  
  <p>My Template : </p>
  
  <pre><code>  {
              "type": "Microsoft.KeyVault/vaults",
              "name": "[parameters('keyVaultName')]",
              "apiVersion": "2016-10-01",
              "location": "[parameters('location')]",
              "properties": {
                  "enabledForDeployment": "[parameters('enableVaultForDeployment')]",
                  "enabledForDiskEncryption": "[parameters('enableVaultForDiskEncryption')]",
                  "enabledForTemplateDeployment": "[parameters('enabledForTemplateDeployment')]",
                  "tenantId": "[parameters('tenantId')]",
                  "accessPolicies": [],
                  "sku": {
                      "name": "[parameters('skuName')]",
                      "family": "A"
                  }
              }
          },
          {
              "type": "Microsoft.KeyVault/vaults/accessPolicies",
              "name": "[concat(parameters('keyVaultName'), '/add')]",
              "apiVersion": "2018-02-14",
              "dependsOn": [
                  "[resourceId('Microsoft.KeyVault/vaults', parameters('keyVaultName'))]"
              ],
              "properties": {
                  "copy": [
                      {
                          "name": "accessPolicies",
                          "count": "[length(parameters('ObjectPolicies'))]",
                          "input": {
                              "tenantId": "[parameters('ObjectPolicies')[copyIndex('accessPolicies')].tenantId]",
                              "objectId": "[parameters('ObjectPolicies')[copyIndex('accessPolicies')].objectId]",
                              "permissions": {
                                  "keys": "[parameters('ObjectPolicies')[copyIndex('accessPolicies')].permissions.keys]",
                                  "secrets": "[parameters('ObjectPolicies')[copyIndex('accessPolicies')].permissions.secrets]"
                              }
                          }
                      }
                  ]
              }
          }
  </code></pre>
  
  <p>My Parameter file:</p>
  
  <pre><code>  "ObjectPolicies": {
              "value": [
                  {
                      "tenantId": "xxxxx",
                      "objectId": "xxxxx",
                      "permissions": {
                          "keys": [
                              "all"
                          ],
                          "secrets": [
                              "all"
                          ]
                      }
                  },
  </code></pre>
  
  <p>I want to Create a Keyvault with multiple access policies inside an object to get a good overview inside my parameters. instead of objectID1 , objectId2, objectId 3.
  Tried to copy the answer from this Good answer over <a href="https://stackoverflow.com/a/53323673/6351302">here</a>.
  It seems that I have the same setup as 4c74356b41 but still have an error message.</p>
  
  <p><a href="https://stackoverflow.com/questions/50628344/arm-template-key-vault-invalid-value-for-accesspolicies">This</a> SO question has also the same error message but he doesn't seem to add an answer to his question.</p>