Azure / Azure/bicep-types-az

[Microsoft.Web/staticSites]: Bicep What-If is inaccurate, returns Delete but property is not allowed on object

Open
#2,465 0 comments 0 reactions 0 assignees View on GitHub
inaccuracy
Dominant language
TypeScript
Stars
108
Forks
44
Avg merge
18h 53m
Merged PRs (30d)
29

Description

### Resource Type

Microsoft.Web/staticSites

### Api Version

2024-04-01

### Issue Type

Inaccurate property type(s)

### Other Notes

This is what the what-if returns:

```what-if
~ Microsoft.Web/staticSites/xxxx [2020-12-01]
- properties.areStaticSitesDistributedBackendsEnabled: false
- properties.deploymentAuthPolicy: "DeploymentToken"
- properties.enterpriseGradeCdnStatus: "Disabled"
- properties.stableInboundIP: "51.124.12.35"
- properties.trafficSplitting:

environmentDistribution.default: 100

```

But this is the Bicep Warning message:

```
Warning BCP037: The property "trafficSplitting" is not allowed on objects of type "StaticSite". Permissible properties include "allowConfigFileUpdates", "buildProperties", "publicNetworkAccess", "repositoryToken", "stagingEnvironmentPolicy", "templateProperties". If this is a resource type definition inaccuracy, report it using https://aka.ms/bicep-type-issues.
```

### Bicep Repro

```bicep
param tags object
param name string
param userAssignedIdentityName string
param userAssignedIdentityResourceGroup string
param sku string = 'Standard'
param skucode string = 'Standard'

var additionalTags = {}

resource userAssignedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' existing = {
name: userAssignedIdentityName
scope: resourceGroup(userAssignedIdentityResourceGroup)
}

resource staticWebApp 'Microsoft.Web/staticSites@2024-04-01' = {
name: name
location: resourceGroup().location
tags: union(tags, additionalTags)
identity: {
type: 'UserAssigned'
userAssignedIdentities: {
'${userAssignedIdentity.id}': {}
}
}
properties: {
// areStaticSitesDistributedBackendsEnabled: false
enterpriseGradeCdnStatus: 'Disabled'
// deploymentAuthPolicy: 'DeploymentToken'
// stableInboundIP: 'xxx.xxx.xxx.xxx'
// keyVaultReferenceIdentity: userAssignedIdentity.id
branch: 'main'
repositoryUrl: 'https://dev.azure.com/xxx'
provider: 'DevOps'
trafficSplitting: {
environmentDistribution: {
default: 100
}
}
}
sku: {
tier: sku
name: skucode
}
}

output defaultHostname string = reference(staticWebApp.id, '2019-12-01-preview').defaultHostName
```

### Confirm

- [x] I have read the troubleshooting guide and looked for duplicates.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by deploying the supplied Bicep repro for Microsoft.Web/staticSites@2024-04-01 and confirm warning BCP037 for properties.trafficSplitting. Trace the resource type definition used for StaticSite, then verify that the definition matches the What-If output and accepts the property without the warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.