Azure Release pipeline - App settings not geting populated

Chris Sessions 6 Reputation points
2020-08-17T00:37:48.64+00:00

Hello,

I am deploying the web app via Build/release pipelines. I have release stage setup and also the variables for that stage. Release happens without any issue but I can not see the variable updated. However when I see the logs "Initialize job" step I can see the variables and values listed correctly. I have also provide the "manage Release" permissions to build and release agents.

Just providing the release log for the stage....

2020-08-16T23:24:53.3916899Z ##[section]Starting: Deploy Azure App Service
2020-08-16T23:24:53.4033923Z ==============================================================================
2020-08-16T23:24:53.4034319Z Task : Azure App Service deploy
2020-08-16T23:24:53.4034749Z Description : Deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby
2020-08-16T23:24:53.4035157Z Version : 4.171.0
2020-08-16T23:24:53.4035400Z Author : Microsoft Corporation
2020-08-16T23:24:53.4035733Z Help : https://aka.ms/azureappservicetroubleshooting
2020-08-16T23:24:53.4036087Z ==============================================================================
2020-08-16T23:24:54.5122986Z Got service connection details for Azure App Service:'xxx'
2020-08-16T23:24:55.1983671Z Trying to update App Service Application settings. Data: {"WEBSITE_RUN_FROM_PACKAGE":"1"}
2020-08-16T23:24:56.0052998Z App Service Application settings are already present.
2020-08-16T23:24:56.6899804Z Package deployment using ZIP Deploy initiated.
2020-08-16T23:25:01.2746403Z Successfully deployed web package to App Service.
2020-08-16T23:25:01.2747236Z NOTE: Run From Package makes wwwroot read-only, so you will receive an error when writing files to this directory.
2020-08-16T23:25:03.6056106Z Successfully added release annotation to the Application Insight : xxx
2020-08-16T23:25:03.9928288Z App Service Application URL: xxx
2020-08-16T23:25:04.0224555Z ##[section]Finishing: Deploy Azure App Service

Also a separate issue when I try to edit setting via Kudu I get access denied error even the user I am logged in is the owner of this project.

ERROR

409 Conflict: Could not write to local resource 'D:\home\site\wwwroot\appsettings.json' due to error 'Access to the path is denied.'.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,295 questions
{count} vote

1 answer

Sort by: Most helpful
  1. singhh-msft 2,431 Reputation points
    2020-08-17T11:05:32.647+00:00

    @Chris Sessions , Thanks for reaching out to us.

    You can follow below steps to update appsettings.json with variables from pipeline and deploy your Web App :

    1. Sign in to https://dev.azure.com/.
    2. Go to your Organisation > Project
    3. Go to Pipelines > Releases > New Pipeline
    4. For Stage 1 > Click on Select a Template > Empty Job
    5. Click on Add an Artifact > Select your Build Pipeline from the dropdown list.
    6. Click on 1 job, 0 task > Add Agent Job
    7. For your Web App Zipped Artifact, you can add Tokenize in Archive task and configure as below: 17977-17.png OR
    8. For your folder structure Web App Artifact, you can add Replace tokens task and configure as below: 18013-18.png
    9. Add Azure App Service deploy task to deploy your Web App. 17908-19.png
    10. Add Pipeline Variables/Variable Groups. I have added Pipeline variables for demo - 17879-20.png
    11. Update replaceable setting values in appsettings.json with specified token prefix and suffix in pipeline tasks above. For e.g., if you choose Replace token task, an example appsettings.json is shown below (here TestVariable will be replaced):
      {  
      
      "Position": {
      "Title": #{TestVariable}#,
      "Name": "Joe Smith"
      },
      "MyKey": "My appsettings.json Value",
      "Logging": {
      "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
      }
      },
      "AllowedHosts": "*"
      }
    12. Save and run the pipeline.
    0 comments No comments