bicep icon indicating copy to clipboard operation
bicep copied to clipboard

Missing type validation / inaccuracies

Open anthony-c-martin opened this issue 4 years ago • 534 comments

Please comment in this issue with any missing or inaccurate type definitions for resources that you would expect to see in Bicep.

Some known issues:

  • ~~Extension resource types modeled with /providers/ segment - tracked under #870~~
  • ~~Missing resource types due to naming clashes - addressed with https://github.com/Azure/bicep-types-az/pull/48 (Bicep v0.2.161+)~~
  • ~~Child resource types with constant name fields - tracked under #657~~

anthony-c-martin avatar Nov 03 '20 18:11 anthony-c-martin

From a multi-resource deployment file:

  • Warning BCP038: The property "features" is not allowed on objects of type "WorkspaceProperties". Permissible properties include "provisioningState", "publicNetworkAccessForIngestion", "publicNetworkAccessForQuery", "workspaceCapping".
  • Warning BCP081: Resource type "Microsoft.OperationalInsights/workspaces/providers/diagnosticSettings@2017-05-01-preview" does not have types available.
  • Warning BCP073: The property "ApplicationId" is read-only. Expressions cannot be assigned to read-only properties.
  • Warning BCP036: The property "Flow_Type" expected a value of type "'Bluefield'" but the provided value is of type "'Redfield'".
  • Warning BCP036: The property "Request_Source" expected a value of type "'rest'" but the provided value is of type "'IbizaAIExtension'".
  • Warning BCP081: Resource type "Microsoft.Web/sites/providers/diagnosticSettings@2017-05-01-preview" does not have types available.
  • Warning BCP081: Resource type "Microsoft.Storage/storageAccounts/providers/eventSubscriptions@2020-04-01-preview" does not have types available.

joshuawaddell avatar Nov 03 '20 19:11 joshuawaddell

The scope property on Microsoft.Authorization/roleAssignments is flagged as read-only but is available for PUT.

bmoore-msft avatar Nov 03 '20 21:11 bmoore-msft

Resource locks show as missing types: https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/lock-resources#arm-template

for a multi resource bicep file for a function app I get the following warnings when adding locks:

  • Resource type "Microsoft.Storage/storageAccounts/providers/locks@2016-09-01" does not have types available.
  • Resource type "Microsoft.OperationalInsights/workspaces/providers/locks@2016-09-01" does not have types available.
  • Resource type "Microsoft.Insights/components/providers/locks@2016-09-01" does not have types available.
  • Resource type "Microsoft.Web/serverFarms/providers/locks@2016-09-01" does not have types available.
  • Resource type "Microsoft.Web/sites/providers/locks@2016-09-01" does not have types available.

sethwenzel avatar Nov 10 '20 14:11 sethwenzel

@sethwenzel - those are all "extension resources" and we'll have a simpler way for constructing them as we did with the scope property in JSON. Anything that has "providers" in the type (diags, roles, locks) will fall into that category.

bmoore-msft avatar Nov 10 '20 16:11 bmoore-msft

I've raised https://github.com/MicrosoftDocs/azure-docs/issues/65815 to update our ARM template JSON samples.

As @bmoore-msft mentioned, this should light up once we have https://github.com/Azure/bicep/blob/main/docs/spec/resource-scopes.md#resource-scope-property implemented. I've created https://github.com/Azure/bicep/issues/870 to track this independently.

anthony-c-martin avatar Nov 10 '20 17:11 anthony-c-martin

Warning BCP081: Resource type "Microsoft.KeyVault/vaults/secrets@2019-09-01" does not have types available. Warning BCP081: Resource type "Microsoft.Web/sites/config@2020-06-01" does not have types available.

SimonWahlin avatar Nov 11 '20 14:11 SimonWahlin

Warning BCP081: Resource type "Microsoft.Network/frontDoors/frontendEndpoints/customHttpsConfiguration@2020-07-01" does not have types available.

johndowns avatar Nov 12 '20 22:11 johndowns

Warning BCP081: Resource type "Microsoft.EventGrid/topics/providers/eventSubscriptions@2018-01-01" does not have types available.

johndowns avatar Nov 13 '20 00:11 johndowns

Resource type "Microsoft.RecoveryServices/vaults@2019-06-01" does not have types available. Resource type "Microsoft.RecoveryServices/vaults/backupstorageconfig@2019-05-13" does not have types available.

Ideally 'Microsoft.RecoveryServices/vaults/backupPolicies@2019-06-15' property Timezone should auto complete valid timezones

Microsoft.Automation/automationAccounts@2015-10-31 is missing location as a required properties: location + Properties -> Sku -> name

ld0614 avatar Nov 13 '20 09:11 ld0614

Resource type "Microsoft.DocumentDB/databaseAccounts/providers/diagnosticSettings@2017-05-01-preview" does not have types available. Resource type "Microsoft.Web/sites/providers/diagnosticSettings@2017-05-01-preview" does not have types available. Resource type "Microsoft.Web/sites/slots/providers/diagnosticSettings@2017-05-01-preview" does not have types available.

I don't know exactly which types you'd expect to provide diagnosticSettings, but it doesn't look like any are included.

dgard1981 avatar Nov 16 '20 16:11 dgard1981

Thanks for reporting @dgard1981 - this is a similar case to /locks above. They are both extension resources, which means they can be appended to any currently existing resource (that supports it). We have a proposal to have a new way of authoring these types of resources at which point we should be able to start validating these properly: https://github.com/Azure/bicep/issues/870

alex-frankel avatar Nov 16 '20 16:11 alex-frankel

Warning BCP081: Resource type "Microsoft.Storage/storageAccounts/providers/roleAssignments@2020-04-01-preview" 
does not have types available.

I would also suspect this is a similar case for other RBAC resource types.

Philo avatar Nov 17 '20 14:11 Philo

Whenever I'm trying to define an Azure Spring Cloud cluster (Microsoft.AppPlatform/Spring@2020-07-01), I'm not given an enum for sku.name or sku.tier

resource mySpring 'Microsoft.AppPlatform/Spring@2020-07-01' = {
  name: 'myCluster'
  location: resourceGroup().location
  sku: {
    name: ''
    tier: ''
  } 
}

markgar avatar Nov 17 '20 18:11 markgar

Originally reported with Azure/bicep#791

--

Bicep version Bicep CLI version 0.1.223-alpha (895cac24a7)

Describe the bug When defining a vnet resource, the properties attribute isn't being marked as required. Per ARM template reference, properties is required: https://docs.microsoft.com/en-us/azure/templates/microsoft.network/virtualnetworks

Furthermore, the properties.addressSpace is required in order for deployment to complete.

To Reproduce

param location string = resourceGroup().location

resource vnet 'Microsoft.Network/virtualNetworks@2020-06-01' = {
    location: location
    name: 'vnet'
}

Types with issue (not exhaustive):

  • Microsoft.Network/virtualNetworks@2020-06-01
  • Microsoft.ContainerService/managedClusters@2020-09-01

Additional context

Expected

  1. Intellisense warning
  2. Error BCP035: The specified object is missing the following required properties

alex-frankel avatar Nov 17 '20 22:11 alex-frankel

resource type 'Microsoft.KeyVault/vaults/secrets' gets autocompleted with a wrong API version. It gets completed to Microsoft.KeyVault/vaults/secrets@2020-04-01-preview instead of Microsoft.KeyVault/vaults/secrets@2019-09-01. When using the proper (2019-09-01) version, one gets the error message below:

Resource type "Microsoft.KeyVault/vaults/secrets@2019-09-01" does not have types available.bicep(BCP081)

kartben avatar Nov 18 '20 16:11 kartben

Bicep version 0.2.14

Describe the bug The resource type @ version Microsoft.Web/connections@2016-06-01 is not available (BCP081)

To Reproduce resource connection 'Microsoft.Web/connections@2016-06-01' = { .. }

smokedlinq avatar Nov 19 '20 01:11 smokedlinq

Bicep CLI version 0.2.46 (fa6e2c5d92)

Element: Microsoft.Web/certificates@2020-06-01 Message: Warning BCP035: The specified "object" declaration is missing the following required properties: "password".

Although reference (https://docs.microsoft.com/en-us/azure/templates/microsoft.web/certificates) describes password as required, in fact it isn't.

miqm avatar Nov 22 '20 08:11 miqm

Bicep version Bicep CLI version 0.2.14

Describe the bug Defining a VPN Gateway Connection 'Microsoft.Network/connections@2020-06-01 and using the id property in the VirtualNetworkGatewayModel object and LocalNetworkGateway object to reference existing VPN Gateways and Local Network Gateways, you get a warning message.

Warning BCP035: The specified "object" declaration is missing the following required properties: "properties".

To Reproduce

resource s2sconnection 'Microsoft.Network/connections@2020-06-01' = {
  name: 'onprem-hub-cn'
  location: location
  properties: {
    connectionType: 'IPsec'
    connectionProtocol: 'IKEv2'
    virtualNetworkGateway1: {
      id: vpngwid
    }
    enableBgp: true
    sharedKey: psk
    localNetworkGateway2: {
      id: localnetworkgw.id
    }
  }
}

StefanIvemo avatar Nov 22 '20 20:11 StefanIvemo

Microsoft.DataFactory/factories/pipelines@2018-06-01 incorrect types under properties->activities. Have this on PR Azure/bicep#999 Looking 'Container' or 'Execution'

JFolberth avatar Nov 29 '20 04:11 JFolberth

'Resource type "Microsoft.KeyVault/vaults/keys@2019-09-01" does not have types available.'

Originally reported in Azure/bicep#1020

alex-frankel avatar Nov 30 '20 22:11 alex-frankel

FYI the keyVault related issues should be resolved in the next 2-3 weeks.

alex-frankel avatar Dec 08 '20 18:12 alex-frankel

Bicep CLI version 0.2.59 (5b0314c03c)

I don't know if this belongs here or not, as the error seems to be on the api side. When trying to deploy Microsoft.Insights/components@2020-02-02-preview, I get the following warning:

Warning BCP035: The specified "object" declaration is missing the following required properties: "Application_Type"

Looking at the reference for the endpoint, it is marked as required, but deploying a resource without is completed successfully. Reference bicep to reproduce:

resource appi 'Microsoft.Insights/components@2020-02-02-preview' = {
  name: appInsightsName
  location: location
  kind: 'web'
  properties: {
    WorkspaceResourceId: log.id
  }
}

DanniJuhl avatar Dec 10 '20 13:12 DanniJuhl

Bicep version: 0.2.59 (5b0314c03c)

Microsoft.EventHub/namespaces@2018-01-01-preview' says: Resource type "Microsoft.EventHub/namespaces@2018-01-01-preview" does not have types available.bicep(BCP081)

JFolberth avatar Dec 10 '20 19:12 JFolberth

Bicep version: 0.2.59 (5b0314c)

Microsoft.EventHub/namespaces@2018-01-01-preview' says: Resource type "Microsoft.EventHub/namespaces@2018-01-01-preview" does not have types available.bicep(BCP081)

This is a result of https://github.com/Azure/azure-rest-api-specs/issues/12065 which I've just raised.

anthony-c-martin avatar Dec 10 '20 20:12 anthony-c-martin

I'm finding that this bicep code

resource asp 'Microsoft.Web/serverfarms@2020-06-01' = {
  location: resourceGroup().location
  name: 'my-app-service-plan'
}

Does not throw an error in bicep, but when deployed gives a very generic error:

"error":{"code":"InvalidTemplateDeployment","message":"The template deployment 'main' is not valid according to the validation procedure. The tracking id is 'd9064387-8ea6-4e9e-ad63-60cd18c2a1e0'. See inner errors for details.","details":[{"message":"Object reference not set to an instance of an object."}]}}

I found that by adding sku.name that things started working.

  sku: {
    name: 'S1'
  }

markgar avatar Dec 11 '20 19:12 markgar

"error":{"code":"InvalidTemplateDeployment","message":"The template deployment 'main' is not valid according to the validation procedure. The tracking id is 'd9064387-8ea6-4e9e-ad63-60cd18c2a1e0'. See inner errors for details.","details":[{"message":"Object reference not set to an instance of an object."}]}}

Thanks for reporting this, I've raised it internally with the Microsoft.Web team.

anthony-c-martin avatar Dec 11 '20 21:12 anthony-c-martin

Adding reports for missing types from https://github.com/Azure/bicep-types-az/issues/28 to this issue (both look like instances of Azure/bicep#657):

  • Microsoft.Web/sites/config@2020-06-01
  • Microsoft.Web/sites/siteextensions@2020-06-01

anthony-c-martin avatar Dec 11 '20 23:12 anthony-c-martin

I think this will be fixed soon already, but wanted to report for completeness.

Resource type "Microsoft.AppConfiguration/configurationStores/keyValues@2020-07-01-preview" does not have types available.

markgar avatar Dec 16 '20 03:12 markgar

This is a little different from my earlier report related to this.

Should sku.name be an enum? I was expecting one...

resource asp 'Microsoft.Web/serverfarms@2020-06-01' = {
  location: resourceGroup().location
  name: 'micro-asp-${unqStr}'
  sku: {
    name: 'S1'
  }
}

markgar avatar Dec 16 '20 03:12 markgar

Should sku.name be an enum? I checked the docs and it isn't listed (https://docs.microsoft.com/en-us/azure/templates/microsoft.appconfiguration/configurationstores) but I think there are only 2 values. standard and free.

resource configSvcs 'Microsoft.AppConfiguration/configurationStores@2020-06-01' = {
  location: resourceGroup().location
  name: 'micro-appcfg-${unqStr}'
  sku: {
    name: 'standard'
  }
}

markgar avatar Dec 16 '20 03:12 markgar