Azure / Azure/azure-rest-api-specs
`Microsoft.Web/sites` - `location` property not in type definition
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 444
Description
Referencing https://github.com/Azure/bicep/issues/4815, `location` doesn't seem to be in the type definition for `Microsoft.Web/sites`. When trying to create a resource using the location of an existing site, I get the following error:
`This expression is being used in an assignment to the "location" property of the "Microsoft.Web/sites" type, which requires a value that can be calculated at the start of the deployment. Properties of webApp which can be calculated at the start include "apiVersion", "id", "name", "type".bicep(BCP120)`
For reference, below is the Bicep template. The input for the `location` property for webApp2 is what is throwing the error.
```yaml
param webAppName string = uniqueString(resourceGroup().id) // Generate unique String for web app name
param sku string = 'P1V2' // The SKU of App Service Plan
param location string = resourceGroup().location // Location for all resources
var appServicePlanName = toLower('mytestASP-${webAppName}')
var webSiteName = toLower('mytestwebappp-${webAppName}')
resource appServicePlan 'Microsoft.Web/serverfarms@2021-01-01' = {
name: appServicePlanName
location: location
properties: {
reserved: true
}
sku: {
name: sku
}
}
resource webApp 'Microsoft.Web/sites@2021-01-01' existing = {
name: 'testapp'
}
resource webApp2 'Microsoft.Web/sites@2021-01-01' = {
name: webSiteName
location: webApp.location
properties: {
serverFarmId: appServicePlan.id
}
}
```
Contributor guide
Research direction
Start with the Microsoft.Web/sites@2021-01-01 definition referenced by the template and compare it with the linked Azure Bicep issue #4815. Confirm how location is represented in this repository's specification data, then validate that an existing-site reference exposes it without BCP120.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi
- Domain
- api, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100