-
Notifications
You must be signed in to change notification settings - Fork 756
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
Keyvault's property VaultUri is not recognized. #15114
Comments
There weren't any changes to the KeyVault types that shipped in v0.30.3 (the most recent change was in v0.29.47), and I'm not able to reproduce this issue without a bit more information. What API version for KV are you using? |
Now this started failing in pipeline also, unfortunately, stopping our work. |
Can you share the exact error message you are seeing? As well as the bicep code you are using to reproduce (as text, not an image)? I am also not able to repro this issue and here is the bicep code I used: resource kv 'Microsoft.KeyVault/vaults@2023-07-01' = {
name: 'foo'
location: 'eastus'
properties: {
sku: {
name: 'standard'
family: 'A'
}
tenantId: subscription().tenantId
}
}
output kvuri string = kv.properties.vaultUri |
Please see the code of the issue below. The exact error message is: The type "object" does not contain property "vaultUri". Available properties include "accessPolicies", "createMode", "enabledForDeployment", "enabledForDiskEncryption", "enabledForTemplateDeployment", "enablePurgeProtection", "enableRbacAuthorization", "enableSoftDelete", "networkAcls", "publicNetworkAccess", "sku", "softDeleteRetentionInDays", "tenantId".bicepBCP053 |
@kappa-mu can you share the complete bicep code as text instead of an image? Please make sure you include everything in the file. It's strange to be getting an error here instead of a warning. When referencing unknown properties in a resource, it should be a warning. I suspect something else in the file may be causing this. Notice in the below example, when I reference an unknown property on a keyvault, this is the warning I get: Also notice the referenced type is not Can you also share the Bicep Extension version? This can be different than the Bicep CLI version. You can find it here: |
Hello @alex-frankel thank you for responding. I am able to work with it with the older version of bicep extension 0.29.47 where the same code does not throw any error. But the code does not work on 0.30.23 or 0.30.3. I was able to continue my work with the older version of the bicep. So it was a low priority problem till last week. But, I use Azure DevOps release pipeline to deploy infrastructure using Azure CLI task. There it was working at least up to 25th September, 2024 when the build version was 0.29.4, this is from log - "2024-09-25T09:38:20.0507372Z VERBOSE: Using Bicep v0.29.47" Since last week, the bicep version of Azure CLI task got updated and it started failing in the pipeline also - "2024-10-18T11:25:07.1621128Z VERBOSE: Using Bicep v0.30.23" and the error message is: Please find the full code below: param ci string
@description('DTAP dtap (DEV,TST,ACC,or PRD)')
@allowed([
'DEV'
'TST'
'ACC'
'PRD'
])
param dtap string
param location string = resourceGroup().location
@description('whether this Keyvault has VNET integration')
param privateInbound bool = false
@description('if disabled no public access is allow only through private endpoint')
param publicNetworkAccess string = 'Enabled'
param sku string = 'standard'
param accessPolicies array = []
param enabledForDeployment bool = false
param enabledForRBAC bool = true
param enabledForTemplateDeployment bool = true
param enabledForDiskEncryption bool = false
param softDeleteRetentionInDays int = 90
param enablePurgeProtection bool = true
param suffix string = ''
@description('whether to create a new or recover a keyvault')
@allowed([
'new'
'existing'
])
param newOrExisting string = 'new'
@description('application name tag')
param applicationName string
var KeyVaultResourceName = empty(suffix) ? 'MSC-KEY-${toUpper(ci)}-${toUpper(dtap)}' : 'MSC-KEY-${toUpper(ci)}-${toUpper(dtap)}-${toUpper(suffix)}'
//var KeyVaultResourceName = 'MSC-KEY-${ci}-${dtap}'
var virtualNetworkRules = privateInbound ? [
{
id: existingVnet::backendsubnet.id
ignoreMissingVnetServiceEndpoint: false
}
] : []
var properties = (newOrExisting == 'new') ? {
createMode: 'default'
enabledForDeployment: enabledForDeployment
enabledForTemplateDeployment: enabledForTemplateDeployment
enabledForDiskEncryption: enabledForDiskEncryption
enableRbacAuthorization: enabledForRBAC
accessPolicies: accessPolicies
tenantId: subscription().tenantId
sku: {
name: sku
family: 'A'
}
enableSoftDelete: true
softDeleteRetentionInDays: softDeleteRetentionInDays
enablePurgeProtection: enablePurgeProtection
networkAcls: {
bypass: 'AzureServices'
defaultAction: 'Deny'
ipRules: []
virtualNetworkRules: virtualNetworkRules
}
publicNetworkAccess: publicNetworkAccess
} : {
createMode: 'recover'
enabledForDeployment: enabledForDeployment
enabledForTemplateDeployment: enabledForTemplateDeployment
enabledForDiskEncryption: enabledForDiskEncryption
enableRbacAuthorization: enabledForRBAC
accessPolicies: accessPolicies
tenantId: subscription().tenantId
sku: {
name: sku
family: 'A'
}
enableSoftDelete: true
softDeleteRetentionInDays: softDeleteRetentionInDays
enablePurgeProtection: enablePurgeProtection
networkAcls: {
bypass: 'AzureServices'
defaultAction: 'Deny'
ipRules: []
virtualNetworkRules: virtualNetworkRules
}
publicNetworkAccess: publicNetworkAccess
}
@description('gather existing vnet')
resource existingVnet 'Microsoft.Network/virtualNetworks@2021-08-01' existing = {
name: 'MSC-VNW-${toUpper(ci)}-${toUpper(dtap)}'
resource backendsubnet 'subnets' existing = {
name: 'MSC-NET-${toUpper(ci)}-${toUpper(dtap)}-BACKEND'
}
}
resource KeyVaultResource 'Microsoft.KeyVault/vaults@2023-07-01' = {
tags: {
'CCC template version': '2.0'
'Application Name': applicationName
}
name: KeyVaultResourceName
location: location
properties: properties
}
output resource object = KeyVaultResource
output resourceId string = KeyVaultResource.id
output keyvaultName string = KeyVaultResourceName
output keyvaultUri string = KeyVaultResource.properties.vaultUri |
Resolves #15397 Worked on this as an alternative way to address #15114 (instead of #15398). This PR does two things: 1. If a ternary has a literally-typed condition (i.e., it is definitely true or definitely false), the type engine will use the type of the active branch's expression. E.g., the type of `true ? 'a' : 'b'` is `'a'`, and the type of `false ? 'a' : 'b'` is `'b'`. There was a TODO comment in TypeAssignmentVisitor suggesting this change. 2. If the types of both branches can be combined instead of represented as a union, the type engine will do so. For example, the type of `unknownCondition ? 'a' : 'b'` is `'a' | 'b'` (a union), but the type of `unknownCondition ? [stringParam] : [intParam]` is `[int | string]` (assuming the type of `stringParam` is `string` and the type of `intParam` is `int`). This change relies on existing type collapsing logic, so it will handle things like combining refinements on string types and combining objects into tagged unions if possible. One change I made to the TypeCollapser is to collapse objects that *can't* be combined into a tagged union into an object whose properties are a union of the possible property types of the inputs. This is similar to how we collapse tuple types. Given a template like the following: ```bicep param a { foo: string } param b { bar: string *: int } param condition bool var value = condition ? a : b ``` `value` would have a type of `{ bar: string, foo: int | string, *: int }`, with all properties flagged as optional. ###### Microsoft Reviewers: [Open in CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/15399)
Bicep version
0.30.3
Describe the bug
Keyvault's property VaultUri is not recognized in version 0.30.3. It is working fine in 0.29.47
To Reproduce
The text was updated successfully, but these errors were encountered: