Azure-Sync: Sync your Azure App Settings to local

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

  1. Ease of Use: azure-sync is easy to install and use. It requires minimal configuration and can be run with a single command.
  2. 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.
  3. 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.
  4. 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!

Recent Posts

HybridCache in .NET 9 is Awesome!
.NET 9 is now live, and it comes with a new set of features. Some are great, and some are just icing on the cake. …
Adding Custom Formatting to Your Classes with IFormattable
DateTime has a great feature that I often replicate in my classes: the ability for users to format the ToString output however they want. Using …
Implement Builders easily with Source Generator in .NET
I created a YouTube video on Source Generator in which I showcased one possible implementation. However, I feel that I didn’t fully highlight its capabilities. …
Secure On-Premise .NET Application with Azure Key Vault
Suppose you have your Web App and Database server hosted locally on your On-Premises servers. You want to use Azure Key Vault with your .NET …

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.