Search code examples
azurepowershellazure-web-app-serviceazure-cliappservice

Enable public access for Azure App Service via AzureCLI


I'm trying to change the access restriction setting on my app service however I cant seem to find the AzureCLI command to do it. Currently the app service is set to Deny public access, however I'm looking for the code to change this setting to true so that I can add new access restrictions. I'm not looking to do this via the portal UI. Does anyone have any idea what command or parameter needs passed in to change this setting, I've already looked at az webapp config access-restriction set but this has no parameter for changing the value.

Access Restrictions


Solution

  • You can use the below cmdlet to enable the public network access to the azure webpp.

    az resource update --resource-group <resourceGroupName> --name <WebappName> --resource-type "Microsoft.Web/sites" --set properties.publicNetworkAccess=Enabled
    

    I have tested this out in cloud shell, it is working fine.

    Here is the sample output for your reference:

    enter image description here