-
Notifications
You must be signed in to change notification settings - Fork 60
Description
Describe the bug
When deploying a Static Web Site via Bicep (or ARM), and when the actual site has been deployed via Azure DevOps Pipelines, the Bicep deployment will fail with the error message:
Provider is invalid. Cannot change the Provider. Please detach your static site first if you wish to use to another deployment provider.
From #495, you can solve this error by setting the provider. In this case, the value needs to be DevOps.
In addition to the provider property, you get similar error message for the properties branch and repositoryUrl.
To Reproduce
Steps to reproduce the behavior:
- Create Bicep file (with empty properties object as instructed in Vague error message #477 to get around another error)
- Deploy via Bicep
- Get the deployment token, create the Azure Pipeline to deploy the site contents, and run it
- Deploy via Bicep again
- See error
Workaround
Set the properties to the correct values. You can see the expected values e.g. from Azure Portal. From the Static Web App overview, click JSON view to see the values. See the example Bicep file below for an example
Expected behavior
Provider, branch, or repositoryUrl should not have to be set in the Bicep file when the site deployment is not done via GitHub.
Screenshots
Example Bicep deployment command and the error message:

Device info (if applicable):
Not applicable.
Additional context
Example Bicep file
param location string = resourceGroup().location
param webappname string = 'mystaticwebsite'
resource webapp 'Microsoft.Web/staticSites@2021-01-15' = {
name: webappname
location: location
//note: must include at least an empty properties object. otherwise you'll get a validation error during deployment
properties: {
//uncomment these and set correct values to make deployment succeed
//provider: 'DevOps'
//branch: 'the_deployed_branch'
//repositoryUrl: 'https://<url to git repo in ADO>'
}
sku: {
name: 'Free'
tier: 'Free'
}
}