This script retrieves environment variables from an Azure App Service and adds them to your local .NET secrets. If the environment variable value is a reference to an Azure KeyVault secret, the script retrieves the actual secret value from Azure KeyVault.
-
Clone this repository and navigate to the directory containing
azure-sync.shandinstall.sh.git clone https://github.com/mhdbouk/azure-sync cd azure-sync -
Run the installation script.
chmod +x ./install.sh && ./install.shThis will copy
azure-sync.shto/usr/local/binand make it executable.
-
Run the script within your .NET application, passing your Azure App Service name and resource group as arguments.
azure-sync <appname> <app_resource_group>
Replace
<appname>with the name of your Azure App Service and<app_resource_group>with the name of the resource group your App Service is in. -
The script will retrieve all environment variables from the specified Azure App Service, including any Azure KeyVault secrets, and add them to your local .NET secrets.
- You must be logged in to the Azure CLI with an account that has access to the specified Azure App Service and any referenced Azure KeyVaults.
- The script replaces double underscores (
__) in environment variable names with colons (:) to match the .NET Core configuration key format.

