0

I have the following YML file to deploy a static web application:

steps:
  - task: AzureResourceManagerTemplateDeployment@3
    displayName: 'Deploy WebApp compute resources'
    inputs:
      azureResourceManagerConnection: ${{parameters.serviceConnection}}
      subscriptionId: ${{parameters.subscriptionId}}
      resourceGroupName: ${{parameters.resourceGroupName}}
      location: ${{parameters.location}}
      csmFile: ${{ parameters.root }}/compute/template.bicep
      csmParametersFile: ${{ parameters.root }}/compute/parameters.json      
      deploymentMode: 'Incremental'
      deploymentOutputs: deploymentOutputs

  - task: AzureStaticWebApp@0
    name: DeployStaticWebApp
    displayName: Deploy Static Web App
    inputs:
      app_location: 'web-app'
      cwd: '${{ parameters.root }}/webapp_package'
      azure_static_web_apps_api_token: $(deployment_token)

template.bicep

resource staticWebApp 'Microsoft.Web/staticSites@2022-03-01' = {
  name: '${solutionAbbreviation}-ui'
  location: location
  sku: {
    name: 'Free'
    tier: 'Free'
  }
  properties: {
    allowConfigFileUpdates: true
    branch: branch
    buildProperties: {
      appLocation: 'UI/web-app'
      skipGithubActionWorkflowGeneration: true
    }
    enterpriseGradeCdnStatus: 'Disabled'
    provider: 'DevOps'
    repositoryUrl: repositoryUrl
    stagingEnvironmentPolicy: 'Disabled'
  }
}

resource staticWebAppAppSettings 'Microsoft.Web/staticSites/config@2022-03-01' = {
  parent: staticWebApp
  name: 'appsettings'
  properties: {
    REACT_APP_AAD_UI_APP_CLIENT_ID: 'ui-client-id'
    REACT_APP_AAD_API_APP_CLIENT_ID: 'api-client-id'
    REACT_APP_AAD_APP_TENANT_ID: 'tenant-id'
    REACT_APP_AAD_APP_SERVICE_BASE_URI: 'url'
  }
}

On running this, I see the static web app deployed however I don't see any config settings. I'm unable to set it manually as well as it's all disabled. What am I missing?

enter image description here

user989988
  • 3,006
  • 7
  • 44
  • 91

1 Answers1

0

I am able to deploy the bicep template with application configuration settings.

I have followed the same template that you have provided.

Check the below steps to deploy the bicep template.

In VSCode, create a new file with .bicep extension and paste the below code in it.

resource staticWebApp 'Microsoft.Web/staticSites@2022-03-01' = {
  name: 'sample-static-ui'
  location: 'westUS2'
  sku: {
    name: 'Free'
    tier: 'Free'
  }
  properties: {
    allowConfigFileUpdates: true
    branch: 'main'
    buildProperties: {
      appLocation: 'UI/web-app'
      skipGithubActionWorkflowGeneration: true
    }
    enterpriseGradeCdnStatus: 'Disabled'
    provider: 'DevOps'
    repositoryUrl: 'https://github.com/Github-Name/webapps-deploy.git'
    stagingEnvironmentPolicy: 'Disabled'
  }
}

resource staticWebAppAppSettings 'Microsoft.Web/staticSites/config@2022-03-01' = {
  parent: staticWebApp
  name: 'appsettings'
  properties: {
    REACT_APP_AAD_UI_APP_CLIENT_ID: 'ui-client-id'
    REACT_APP_AAD_API_APP_CLIENT_ID: 'api-client-id'
    REACT_APP_AAD_APP_TENANT_ID: 'tenant-id'
    REACT_APP_AAD_APP_SERVICE_BASE_URI: 'url'
  }
}

  • Right click on the .bicep file and select Deploy the bicep file

enter image description here

enter image description here

After deployment I am able to see the application settings.

enter image description here

  • Now Check the configuration settings.

enter image description here

RohitVarun
  • 68
  • 3