7

Is there an easy way to export all the AppSettings for each of my Web Apps in every App Service Plan for a given Resource Group?

I've currently got about 20 apps running under different App Service Plans for a given Resource Group and I'm in the process of creating an Azure Resource Manager (ARM) template for easy allocation/dellocation of resources and I've found that the "Automation Script" feature to be largely helpful but it doesn't seem to export any of the AppSettings I've added via the Webapp's Application Settings blade within the Azure Portal.

enter image description here

enter image description here

2 Answers 2

12

You can download the App settings in different ways. Few are using Kudu Console/Resource Explorer/PowerShell.

To access the site through the Kudu console, use the below URL. https://****.scm.azurewebsites.net/ (enter your website name instead of ****)

Goto App Settings -> download

enter image description here

You can also download this from ‘Resource explorer’ option available in Azure Portal.

Goto Web App -> Development Tools -> Resource explorer -> select the resource -> download the settings

Below PowerShell cmdlets will also help you to download the App Settings.

$app = Get-AzureRmWebApp -ResourceGroupName YourRGName -Name YourAppName
$app.SiteConfig.AppSettings
$app.SiteConfig.ConnectionStrings

For more details on how to use PowerShell for Web Apps, refer: Azure PowerShell Samples

You may also check the blog post how to Export Azure WebApp Application Settings & Configuration Strings To CSV

Hope this helps.

1
  • 1
    Also the Azure CLI can do this. eg. az webapp config appsettings list --n webAppName -g resouceGroupName Commented Jun 22, 2022 at 2:06
6

In response to @Ashok's post I've created a powershell script which loops through every single Resource Group's App Service and exports the each app service's app settings to a CSV file.

$allWebApps = Get-AzureRmWebApp
$resourceGroups = $allWebApps | Select-Object 'ResourceGroup' -Unique
foreach($r in $resourceGroups)
{
    $rgName = $r.ResourceGroup    
    $webApps = Get-AzureRmWebApp -ResourceGroupName $rgName

    foreach($w in $webApps)
    {
        $webAppName = $w.Name        
        Write-Host Processing Webapp : $webAppName

        $webApp = Get-AzureRmWebApp -ResourceGroupName $rgName -Name $webAppName
        $appSettings = $webApp.SiteConfig.AppSettings

        # Extract AppSettings to CSV
        $appSettings.GetEnumerator() | 
                Sort-Object -Property Name -Descending |
                Select-Object -Property @{n='Key';e={$_.Name}},Value |
                Export-Csv -Path C:\Azure\$webAppName.csv -NoTypeInformation -Append

    }    
}

I wish there was a nicer way to do this though. I might just add that it has been voiced (somewhat) in the Azure's Feedback Forum's for Azure Resource Manager. If anyone feels it's a useful feature, please cast your votes in the feedback.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.