Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to create certain sub-resources due to name restrictions #1106

Closed
peter-bertok opened this issue Dec 10, 2020 · 1 comment
Closed

Comments

@peter-bertok
Copy link

peter-bertok commented Dec 10, 2020

Bicep version
Bicep CLI version 0.2.59 (5b0314c)

Describe the bug
I tried to update permissions for a Key Vault incrementally using a snippet such as the following:

resource webapp_kv_access 'Microsoft.KeyVault/vaults/accessPolicies@2020-04-01-preview' = {
  name:'${prefix}/add'
  properties:{
    accessPolicies:[
      {
              
      }
    ]
  }
}

Additional context
The error is BCP036, saying that the name must be "add|remove|replace", but this is a sub-resource, which means that it must have a prefix. This naming restriction is only valid when the subresource is defined inline, and that's actually a useless scenario for this particular resource. It is intended to be defined using the full resource syntax to enable incremental updates. In this case, I'm trying to have a bunch of App Service web apps all have access to the same KV.

It looks like BICEP is getting the restriction from here: https://github.com/Azure/azure-resource-manager-schemas/blob/54b5ec6b33f2f21d9968140ab67c61e6eab39fba/schemas/2016-10-01/Microsoft.KeyVault.json#L84

My suggestion is that resource name restrictions based on string enums should only consider the part after the last forward slash. If that's impossible (due to dynamic name generation), then it should simply ignore name restrictions for sub-resources.

@ghost ghost added the Needs: Triage 🔍 label Dec 10, 2020
@alex-frankel
Copy link
Collaborator

alex-frankel commented Dec 10, 2020

Closing as dup of #836

@ghost ghost locked as resolved and limited conversation to collaborators May 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants