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.
From the Azure portal, follow these steps: Browse to your App Configuration store, and select Import/export. On the Export tab, select Configuration file under Target service.
config or appsettings. json and production secrets (for example, Azure MySQL database password) safely in App Service. The same code uses your development settings when you debug locally, and it uses your production secrets when deployed to Azure.
You can find the connection string under Access Keys of your App Configuration store in the Azure portal.
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
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With