Search code examples
jsonazure-devopsazure-appservicevariable-substitution

##[error]Error: NO JSON file matched with specific pattern: **/appsettings.json


I'm trying to deploy an Azure App Service using Azure Devops.

I'm using the Task Azure App Service deploy version 4.*

I started noticing the following error in the log recently with the deployment failing (saw it first on 24th September)

Applying JSON variable substitution for **/appsettings.json
##[error]Error: NO JSON file matched with specific pattern: **/appsettings.json.

In the pipeline I use the task Extract files to extract *.zip, then use the result to search for **/appsettings.json.

The same task was running fine till a few days ago.
I tried redeploying an old release which was successful earlier, but it failed now with the same above error.

I double checked, there was no changes done in the pipeline recently for this to break.

How can I fix this.


Solution

  • Turns out my issue was not with the task Azure App Service deploy, but with the task Extract Files.

    A rough look on my pipeline is as below:

    Before the fix

    1. Extract files
      enter image description here
    2. Deploy Azure App Service enter image description here

    The JSON variable substitution failed because the Extract files task was not able to find *.zip files in the root folder and hence extracted nothing. So, there was no appsettings.json file in the folder structure at all.

    The Fix

    • Update the Extract files task search pattern as **/*.zip

    Now my pipeline looks like below.

    1. Extract files
      enter image description here
    2. Deploy Azure App Service enter image description here

    It now works fine for me.