Azure App Configuration is a powerful service for managing application settings and feature flags centrally, however, I found that the export options were somewhat lacking for my use-case, which was deprecating an old App Configuration resource where I needed ideally a csv file so I could run comparisons against another system.
In this post, we’ll walk through a PowerShell script that extracts App Configuration key-values and exports them to a CSV.
Exporting Azure App Configuration to CSV
We’ll use PowerShell and the Az.AppConfiguration module to authenticate, retrieve config values, parse them, and save to CSV.
Prerequisites
- Azure PowerShell (
Azmodule installed) - Reader access to the App Configuration resource
- The
Az.AppConfigurationmodule: install viaInstall-Module Az.AppConfiguration
The PowerShell Script
Here’s the complete script –
# Update all variables as required
$Tenant = "############"
$Subscription = "############"
$appConfigurationEndpoint = "https://nameOTheAppConfig.azconfig.io"
$date = Get-Date
$exportPath = "c:\temp\AppConfigurationExport-$($date.Year)$($date.Month)$($date.Day)$($date.Millisecond).csv"
Connect-AzAccount -TenantId $Tenant -Subscription $Subscription | Out-Null
# Get all entries in the App Configuration
$entries = Get-AzAppConfigurationKeyValue -Endpoint $appConfigurationEndpoint
# Process each entry to pull the required values
$output = @()
for($i=0; $i -lt $entries.count; $i++) {
$e = $entries[$i]
$eValue = $e.Value | ConvertFrom-Json
$output += [PSCustomObject]@{
Label = $e.Label
Key = $e.Key
Id = $eValue.id
Description = $eValue.description
Enabled = $eValue.enabled
}
}
# Export all entries to a CSV
$output | Export-Csv -Path $exportPath -NoClobber
Invoke-Item $exportPath







Leave a comment