Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
330 stars 57 forks source link

[Bicep/ARM] Cannot set custom domain #608

Open sinedied opened 3 years ago

sinedied commented 3 years ago

Describe the bug

I'm trying to create a SWA from scratch using Bicep, and setting custom domains the same way.

My template looks like this for the SWA part:

resource staticWebApp 'Microsoft.Web/staticSites@2021-01-15' = {
  name: '${appName}-staticwebapp${dashSuffix}'
  location: location
  sku: {
    name: 'Standard'
    tier: 'Standard'
  }
  properties: {
    repositoryUrl: 'https://github.com/${githubRepo}'
    branch: 'main'
    provider: 'GitHub'
    repositoryToken: githubToken
    buildProperties: {
      appLocation: '/'
      apiLocation: ''
      outputLocation: 'dist/${projectName}'
      skipGithubActionWorkflowGeneration: true
      githubActionSecretNameOverride: 'AZURE_SWA_TOKEN'
    }
    stagingEnvironmentPolicy: 'Enabled'
    allowConfigFileUpdates: true
    userProvidedFunctionApps: [
      {
          functionAppResourceId: functionApp.id
          functionAppRegion: location
      }
    ]
  }
  dependsOn: [
    functionApp
  ]

  resource staticWebAppDomains 'customDomains@2021-01-15' = [for domain in domains: {
    name: domain
    properties: {
      validationMethod: 'dns-txt-token'
    }    
  }]
}

I would like to use TXT validation for validating the domain names, as seen here in the template. I have 2 issues doing that:

Note that I'm deploying the bicep template with az deployment group create.

Expected behavior

Adding customDomains resources to my SWA Bicep template should work without getting stuck in the process, and I should be able to retrieve the generated validation codes to use then in the Azure DNS part of the Bicep template.

Additional info:

I should mention that the custom domain are correctly set, as I can see them in the Azure portal, in the custom domains section of the deployed SWA, waiting on "validating" message.

abouroubi commented 2 years ago

Is there any new on this ? Can't seem to find any documentation regarding how to fill the validation method

trondjun commented 2 years ago

Did you find a way to get through the validation of custom domain?

I have the same issue now, and it just gets stuck on validating.

sinedied commented 2 years ago

Currently there's no solution, but the team is looking at it. cc @simonaco

trondjun commented 2 years ago

Great! If there is anything I can provide to help, let me know!

chrisjensenuk commented 2 years ago

We've just hit this issue too. Any update on this? Thanks

AnthonyPhan commented 2 years ago

same issue here, any updates?

Gertray13 commented 2 years ago

Same issue here. Does someone has a workaround?

larsmaes-sogeti commented 2 years ago

Same problem here, still no workaround?

abouroubi commented 2 years ago

Looks like they don't care, this product is half baked, it was made in a hurry as an answer to AWS Amplify.

larsmaes-sogeti commented 2 years ago

It ssems to be somewhat related to: https://github.com/Azure/bicep/issues/4483

andrem0 commented 1 year ago

No progress here? @simonaco @sinedied

sinedied commented 1 year ago

Simona isn't working on the team anymore, and I don't have any news regarding this. Maybe @anthonychu have an update on this, as it's likely to concern all App Services products?

LarsKemmann commented 1 year ago

Anything? Any update at all? It's been almost two years for a basic automation ask.

TheCloudWarrior commented 11 months ago

Anything? Any update at all? It's been almost two years for a basic automation ask.

I think its a bit weird that someone has left the team and apparently all work has stopped. Just look at the Github issues.

Anyways, the only way I have found this works is to use a deployment script to make an API call to get the validationToken and then create a TXT record in your DNS. I do not like using deploymentScripts but I like copy/pasting TXT records even less... I have a little example here: https://github.com/TheCloudWarrior/AzureStaticWebApp

I hope I have taken out all hardcoded variables :)