Search code examples
azureazure-bicep

Azure - Bicep deployment - API version changing when deploying


I'm having a weird issue when deploying resources using Bicep that I'm hoping someone can share some light on.

For several resources I am deploying, I am trying to deploy with the non-preview versions of the API, for example:

resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' = {
  name: name
  location: location
  properties: {
    sku: {
      name: sku
    }
    retentionInDays: logAnalyticsRetentionInDays
  }

  tags: tags
}

When I deploy this, it deploys succesfully, however when I check in the portal,the Log Analytics workspace has defaulted to "apiVersion": "2021-12-01-preview".

This is occurring for a few different resources such as API Management as well. Can anyone give any insight on why this occurs and if there's a way to not have it occur?

Thanks,


Solution

  • Any insight on why this occurs and if there's a way to not have it occur.

    • Preview versions are similar to updated versions released by the team prior to gathering feedback or verifying the functionality.

    • Version will be automatically set to the latest/preview version after deployment, depending on the properties/fields provided in the bicep resource type.

    • A few Azure Services may no longer support non-preview versions when deployed using bicep. Use Azure CLI in that case.

      In the Json/parameters file, every resource type includes a version parameter. If required, provide the required version.

    enter image description here

    enter image description here

    Note: I would suggest you not to use non preview versions as some of them doesn't have the updated fields & functionality.

    Refer MSDoc: 1 & 2