Azure-Sync is a handy shell script tool designed to help .NET developers working with Azure App Services. Inspired by the functionality provided by the Azure Functions Core Tools (func cli), Azure-Sync allows you to retrieve all environment variables from a specified Azure App Service, including any Azure KeyVault secrets, and add them to your local .NET secrets.
Check the source code on GitHub: mhdbouk/azure-sync
How to use Azure-Sync
Using azure-sync
is straightforward. Here are the steps
First, clone the Azure-Sync repository to your local machine. You can do this by running the following command in your terminal:
git clone https://github.com/mhdbouk/azure-sync.git
Navigate to the cloned repository and install the tool by running the following command in your terminal:
chmod +x ./install.sh && ./install.sh
This command makes the install.sh
script executable and runs it. The script copies azure-sync.sh
to /usr/local/bin
and makes it executable.
Once installed, you can run azure-sync
within your .NET application by 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.
Benefits of Using Azure-Sync
Azure-Sync provides several benefits
- Ease of Use:
azure-sync
is easy to install and use. It requires minimal configuration and can be run with a single command. - Time-Saving:
azure-sync
automates the process of retrieving environment variables from Azure App Service, saving you the time and effort of doing it manually. - Local Development and Debugging: By syncing your Azure environment variables locally, you can ensure that your local development environment closely matches your production environment. This can help catch potential issues early in the development process. Moreover, it allows you to debug actual production issues by replicating the production environment locally.
- Security:
azure-sync
prioritizes security by retrieving secrets from Azure KeyVault and storing them in .NET user secrets. This approach ensures that your application has all the necessary configuration for local development, while also preventing sensitive information from being accidentally committed to your Git repository. This way, Azure-Sync helps maintain the integrity and confidentiality of your application’s secrets.
Remember, 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.
Happy coding!