Skip to content
New issue

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

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

Already on GitHub? # to your account

[Bug Report]: Use networkAcls with key vault #2159

Closed
gsuttie opened this issue Oct 1, 2022 · 2 comments
Closed

[Bug Report]: Use networkAcls with key vault #2159

gsuttie opened this issue Oct 1, 2022 · 2 comments
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation wait for author

Comments

@gsuttie
Copy link

gsuttie commented Oct 1, 2022

Describe the bug

I am trying to add vnet integration to my Keyvault and all the doc say to do this:-

networkAcls: {
bypass: 'AzureServices'
defaultAction: 'Deny'
ipRules: []
virtualNetworkRules: [
{
id: '/subscriptions/${subscriptionid}/resourceGroups/${resourceGroup}/providers/Microsoft.Network/virtualNetworks/${myVnet}/subnets/${mysubnet}
}
]

But I am getting this error - InvalidTemplate - Deployment template validation failed: 'The template variable 'virtualNetworkRules' is not valid: The language expression property 'subnet' doesn't exist, available properties are 'id'.. Please see https://aka.ms/arm-template-expressions for usage details.'.

If I comment out the id its fine so something related to that isn't right.

They API I am using is from the Keyvault Bicep in this repo so version Microsoft.KeyVault/vaults@2019-09-01

To reproduce

Create a Keyvault and attempt to associate add a reference to an existing vnet with a subnet (this is for API management in the end).

Code snippet

module createKeyVault 'modules/keyVault.bicep' = {
  scope: resourceGroup(networkHubRg)
  name: KeyVaultName
  params: {
    name: KeyVaultName
    location: primaryLocation
    vaultSku: vaultSku
    tags: tags
    enableVaultForDeployment: true
    enableVaultForTemplateDeployment: true
    enableRbacAuthorization: true
    
    vNetId: '${virtualnetworks_vnet_connectivity_dev_weu_externalid}/subnets/${apimSubnetName}'
    
    networkAcls: {
      bypass: 'AzureServices'
      defaultAction: 'Deny'
      ipRules: []
      virtualNetworkRules: [
        {
          id: '/subscriptions/${subscriptionId}/resourceGroups/${networkHubRg}/providers/microsoft.network/virtualnetworks/${hubVNetName}/subnets/${mysubnet}'
        }
      ]
  }
  }
  dependsOn: [
    NewPrimaryRG
  ]
}

Relevant log output

InvalidTemplate - Deployment template validation failed: 'The template variable 'virtualNetworkRules' is not valid: The language expression property 'subnet' doesn't exist, available properties are 'id'.. Please see https://aka.ms/arm-template-expressions for usage details.'.
@gsuttie gsuttie added the bug Something isn't working label Oct 1, 2022
@eriqua eriqua changed the title [Bug Report]: [Bug Report]: Use networkAcls with key vault Oct 2, 2022
@rahalan rahalan added the documentation Improvements or additions to documentation label Oct 4, 2022
@eriqua eriqua self-assigned this Oct 4, 2022
@eriqua eriqua linked a pull request Oct 4, 2022 that will close this issue
10 tasks
@eriqua eriqua removed a link to a pull request Oct 5, 2022
10 tasks
@eriqua
Copy link
Contributor

eriqua commented Oct 10, 2022

Hey @gsuttie, first of all thanks for raising this issue. After your heads-up, we noticed a couple of parameter usage snippets from the module readme file were incorrect, and we fixed them. You can find the updated readme here.

Concerning the matter at hand, the snippet you provided for networkAcls above looks correct, and it's what we're using in our common deployment validation test for keyvault, which you can reference here.

However, the vnetId parameter you shared in the above code snippet is not part of the module input parameters. Could you please remove that line, redeploy the snippet and share the result?

@rahalan rahalan moved this to Low priority in Bug board Dec 11, 2022
@rahalan
Copy link
Contributor

rahalan commented Feb 23, 2023

Issue should not happen with correct parameter settings according to updated documentation. Thanks for bringing it to our attention. If issue still persists, please open a new issue.

@rahalan rahalan closed this as completed Feb 23, 2023
@github-project-automation github-project-automation bot moved this from Low priority to Closed in Bug board Feb 23, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation wait for author
Projects
Status: Closed
Development

No branches or pull requests

3 participants