Azure / Azure/static-web-apps

Deployment fails for private or internal (GitHub Enterprise) repo

Open
#613 5 comments 0 reactions 0 assignees View on GitHub
needs author feedback
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

I used a Bicep ARM template to create a static web app in a resource group. When running the template another time after making updates to other resources in my template or adding new resources, the static web app resource fails to update. I receive this error:

```json
{
"error":{
"code":"InvalidTemplateDeployment",
"message":"The template deployment 'main' is not valid according to the validation procedure. The tracking id is '4e9c0af0-75fe-4b3d-a63e-819b5031b4d1'. See inner errors for details.",
"details":[
{
"code":"BadRequest",
"message":"RepositoryUrl is invalid. Cannot change the RepositoryUrl. Please detach your static site first if you wish to attach to another repository."
}
]
}
}
```

The repo that is being linked to the static web app is an **internal** repository in my company's GitHub Enterprise organization. It seems like it fails for either private or internal repositories because the repos cannot be found without authentication and GitHub returns a 404 for the repository.

**To Reproduce**

My Bicep template looks like this:

```
resource webApp 'Microsoft.Web/staticSites@2021-01-15' = {
name: 'projecthub-${productEnvironment}'
location: location
tags:{
Environment: productEnvironment
}
sku:{
name: 'Standard'
tier: 'Standard'
}
properties:{
stagingEnvironmentPolicy: 'Enabled'
allowConfigFileUpdates: true
provider: 'GitHub'
repositoryUrl: 'https://github.com/neudesic/projects-web'
branch: 'main'
buildProperties:{
skipGithubActionWorkflowGeneration: true
}
}
}
```

`productEnvironment` is one of `dev`, `test`, or `prod`.

I am using the Azure CLI to run the deployment:

az deployment group create --resource-group projecthub-dev --template-file main.bicep --parameters @parameters.dev.json

**Expected behavior**

I expect that the deployment will succeed and that the Azure Static Web App resource will not be altered if no changes were made, or will be updated if settings do change.

**Device info (if applicable):**

- macOS Big Sur 11.6
- Azure CLI:

```json
{
"azure-cli": "2.29.0",
"azure-cli-core": "2.29.0",
"azure-cli-telemetry": "1.0.6",
"extensions": {}
}
```

**Additional context**

This only seems to affect private or internal repos hosted in GitHub.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.