Open ameltzer-MSFT opened 5 months ago
I was able to work around this problem by doing something like this:
// Required properties
param frontDoorSkuName string
param frontDoorProfileName string
// Work around deployment breaking for premium SKU if it already exists
resource frontDoorProfileExisting 'Microsoft.Cdn/profiles@2023-05-01' existing = if (frontDoorSkuName == 'Premium_AzureFrontDoor') {
name: frontDoorProfileName
}
// Profile
resource frontDoorProfile 'Microsoft.Cdn/profiles@2023-05-01' = if (frontDoorProfileExisting.id == null) {
name: frontDoorProfileName
location: 'global'
tags: union(resourceGroup().tags, { ComponentName: 'FrontDoorCDN-Profile' })
sku: {
name: frontDoorSkuName
}
}
However, it seems like this should have been handled gracefully by Bicep/ARM internally without needing to resort to this kind of workaround :).
Resource Type
Microsoft.Cdn/profiles
Api Version
2023-05-01
Issue Type
Resource fails to deploy
Other Notes
This does not repro when using standard SKU, only premium SKU.
When deploying a premium SKU CDN Profile, the initial deployment works fine. Subsequent deployments will fail in ARM with an error like this:
Property 'profile.sku' is read-only and cannot be changed
The 'sku' property cannot be removed from the bicep template as this emits a warning:
The specified "resource" declaration is missing the following required properties: "sku". If this is an inaccuracy in the documentation, please report it to the Bicep Team.bicephttps://aka.ms/bicep-type-issues
Suppressing this warning will cause the deployment to fail in validation.
This breaks deployments with this resource because only the initial deployment will work and subsequent deployments will fail.
As mentioned before, this does not reproduce when using "Standard" SKU, only "Premium" SKU (probably because you can go from Standard to Premium, but once you're Premium you can't go back).
Bicep Repro
Confirm