Home > Blockchain >  Azure App Service CORS setting not working from ARM
Azure App Service CORS setting not working from ARM

Time:09-20

I am deploying a web app using ARM. There are no errors with the deployment and everything deploys fine EXCEPT my CORS settings. Below is my siteConfig definition for the app service.

"siteConfig": {
                "AlwaysOn": true,
                "linuxFxVersion": "NODE|16-lts",
                "appCommandLine": "startup command goes here",
                "cors": {
                    "allowedOrigins": "[parameters('backEndCORSOrigins')]",
                    "supportCredentials": false
                },
                "appSettings": "ENV_VARS_GO_HERE",
                "scmIpSecurityRestrictions": "[parameters('backEndSCMIPRestrictions')]",
                "IpSecurityRestrictions": "[parameters('backEndIPRestrictions')]"
            }

And my parameter setting.

"backEndCORSOrigins": {
        "value": "https://hostname.azurewebsites.net"
    },

When I deply this ARM templte these is NO CORS setting applied on the app service.

CodePudding user response:

Not sure about the ARM api version you are using but according to the documentation, the property allowedOrigins accept an array of string:

"cors": {
  "allowedOrigins": [
    "[parameters('backEndCORSOrigins')]"
  ],
  "supportCredentials": false
}
  • Related