Static Web Site: The `provider` in `StaticSite` model is not read only
Given following static site resource:
GET <REDACTED>/api-version=2021-02-01
Response:
{
"id": "REDACTED",
"name": "example",
"type": "Microsoft.Web/staticSites",
"location": "West Europe",
"tags": {
"foo": "bar"
},
"properties": {
"defaultHostname": "REDACTED",
"repositoryUrl": "https://github.com/magodo/my-first-static-web-app",
"branch": "main",
"customDomains": [],
"privateEndpointConnections": [],
"stagingEnvironmentPolicy": "Enabled",
"allowConfigFileUpdates": true,
"contentDistributionEndpoint": "https://content-am2.infrastructure.1.azurestaticapps.net",
"keyVaultReferenceIdentity": "SystemAssigned",
"userProvidedFunctionApps": [],
"linkedBackends": null,
"provider": "Github",
"enterpriseGradeCdnStatus": "Disabled",
"publicNetworkAccess": null
},
"sku": {
"name": "Standard",
"tier": "Standard"
},
"identity": {
"type": "SystemAssigned",
"tenantId": "REDACTED",
"principalId": "REDACTED"
}
}
If I copy the model above and take it as the request body in another PUT, removing the read only properties:
PUT <REDACTED>/api-version=2021-02-01
Request:
{
"id": "REDACTED",
"name": "example",
"type": "Microsoft.Web/staticSites",
"location": "West Europe",
"tags": {
"foo": "bar"
},
"properties": {
"repositoryUrl": "https://github.com/magodo/my-first-static-web-app",
"branch": "main",
"stagingEnvironmentPolicy": "Enabled",
"allowConfigFileUpdates": true
},
"sku": {
"name": "Standard",
"tier": "Standard"
},
"identity": {
"type": "SystemAssigned",
"tenantId": "REDACTED",
"principalId": "REDACTED"
}
}
The API returns:
{
"Code": "BadRequest",
"Message": "Provider is invalid. Cannot change the Provider. Please detach your static site first if you wish to use to another deployment provider.",
"Target": null,
"Details": [
{
"Message": "Provider is invalid. Cannot change the Provider. Please detach your static site first if you wish to use to another deployment provider."
},
{
"Code": "BadRequest"
},
{
"ErrorEntity": {
"ExtendedCode": "51021",
"MessageTemplate": "{0} is invalid. {1}",
"Parameters": [
"Provider",
"Cannot change the Provider. Please detach your static site first if you wish to use to another deployment provider."
],
"Code": "BadRequest",
"Message": "Provider is invalid. Cannot change the Provider. Please detach your static site first if you wish to use to another deployment provider."
}
}
],
"Innererror": null
}
To fix this, I need to add "provider": "Github" in above request. This indicates that either the provider property in the StaticSite model is incorrectly marked as read only, or the service behavior is not expected.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzureAppServiceCLI, @antcp.
Issue Details
Given following static site resource:
GET <REDACTED>/api-version=2021-02-01
Response:
{
"id": "REDACTED",
"name": "example",
"type": "Microsoft.Web/staticSites",
"location": "West Europe",
"tags": {
"foo": "bar"
},
"properties": {
"defaultHostname": "REDACTED",
"repositoryUrl": "https://github.com/magodo/my-first-static-web-app",
"branch": "main",
"customDomains": [],
"privateEndpointConnections": [],
"stagingEnvironmentPolicy": "Enabled",
"allowConfigFileUpdates": true,
"contentDistributionEndpoint": "https://content-am2.infrastructure.1.azurestaticapps.net",
"keyVaultReferenceIdentity": "SystemAssigned",
"userProvidedFunctionApps": [],
"linkedBackends": null,
"provider": "Github",
"enterpriseGradeCdnStatus": "Disabled",
"publicNetworkAccess": null
},
"sku": {
"name": "Standard",
"tier": "Standard"
},
"identity": {
"type": "SystemAssigned",
"tenantId": "REDACTED",
"principalId": "REDACTED"
}
}
If I copy the model above and take it as the request body in another PUT, removing the read only properties:
PUT <REDACTED>/api-version=2021-02-01
Request:
{
"id": "REDACTED",
"name": "example",
"type": "Microsoft.Web/staticSites",
"location": "West Europe",
"tags": {
"foo": "bar"
},
"properties": {
"repositoryUrl": "https://github.com/magodo/my-first-static-web-app",
"branch": "main",
"stagingEnvironmentPolicy": "Enabled",
"allowConfigFileUpdates": true
},
"sku": {
"name": "Standard",
"tier": "Standard"
},
"identity": {
"type": "SystemAssigned",
"tenantId": "REDACTED",
"principalId": "REDACTED"
}
}
The API returns:
{
"Code": "BadRequest",
"Message": "Provider is invalid. Cannot change the Provider. Please detach your static site first if you wish to use to another deployment provider.",
"Target": null,
"Details": [
{
"Message": "Provider is invalid. Cannot change the Provider. Please detach your static site first if you wish to use to another deployment provider."
},
{
"Code": "BadRequest"
},
{
"ErrorEntity": {
"ExtendedCode": "51021",
"MessageTemplate": "{0} is invalid. {1}",
"Parameters": [
"Provider",
"Cannot change the Provider. Please detach your static site first if you wish to use to another deployment provider."
],
"Code": "BadRequest",
"Message": "Provider is invalid. Cannot change the Provider. Please detach your static site first if you wish to use to another deployment provider."
}
}
],
"Innererror": null
}
To fix this, I need to add "provider": "Github" in above request. This indicates that either the provider property in the StaticSite model is incorrectly marked as read only, or the service behavior is not expected.
| Author: | magodo |
|---|---|
| Assignees: | - |
| Labels: |
|
| Milestone: | - |
Ping @AzureAppServiceCLI, @antcp, @JackTn
Ping @antcp, @JackTn