Azure / bicep-types-az

Bicep type definitions for ARM resources
MIT License
86 stars 27 forks source link

Incorrect warning: The property "logging" is not allowed on objects of type "QueueServicePropertiesProperties" #1742

Open elvenstone opened 2 years ago

elvenstone commented 2 years ago

Bicep version 0.7.4

Describe the bug The following Bicep code for deploying a queue service with properties for logging results in the following warning: The property "logging" is not allowed on objects of type "QueueServicePropertiesProperties". No other properties are allowed.

To Reproduce

resource queueService 'Microsoft.Storage/storageAccounts/queueServices@2021-09-01' = {
  parent: storageAccount
  name: 'default'
  properties: {
    cors: {
      corsRules: []
    }

    logging: {
      delete: false
      read: false
      retentionPolicy: {
        enabled: false
      }
      version: '1.0'
      write: false
    }      
  }
}

Additional context The parent storage account resource is defined as follows:

resource storageAccount 'Microsoft.Storage/storageAccounts@2021-09-01' = {
  name: stName
  location: location
  sku: {
    name: skuName
  }
  kind: 'StorageV2'
  properties: {
    minimumTlsVersion: 'TLS1_2'
    allowBlobPublicAccess: true
    networkAcls: {
      bypass: 'AzureServices'
      virtualNetworkRules: []
      ipRules: []
      defaultAction: 'Allow'
    }
    supportsHttpsTrafficOnly: true
    encryption: {
      services: {
        file: {
          keyType: 'Account'
          enabled: true
        }
        blob: {
          keyType: 'Account'
          enabled: true
        }
      }
      keySource: 'Microsoft.Storage'
    }
    accessTier: 'Hot'
  }
}

As a workaround, I inserted #disable-next-line BCP037# above the logging object to ignore the warning:

#disable-next-line BCP037
    logging: {

I added the logging object because running what-if without it resulted in the following change:

  ~ Microsoft.Storage/storageAccounts/testfoto/queueServices/default [2021-09-01]
    - properties:

        logging.delete:                  false
        logging.read:                    false
        logging.retentionPolicy.enabled: false
        logging.version:                 "1.0"
        logging.write:                   false
thanos-kataras commented 1 year ago

+1. I encountered the same bug today and mitigated it in the same way also adding a comment that leads here.

dollarpo7 commented 1 year ago

I encountered the same bug today but when i add the logging properties like you @TsakyDev and @elvenstone did my deployment fails with the error below:

{"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions/xxxxxx/resourceGroups/xxxxx/providers/Microsoft.Resources/deployments/main","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"InvalidXmlDocument","message":"XML specified is not syntactically valid. But when i comment the logging property, it deploys successfully.

Japeth commented 2 months ago

This is still an issue....2+ years later. I encounter the same error as dollarpo7 when trying to add the logging block.