Using Azure Key Vault to store connection strings – Xlinesoft Blog


Azure Key Vault offers secure storage for sensitive information like passwords, secrets, etc. If you host your PHPRunner or ASPRunner.NET application in Azure, it makes sense to store your connection string in Key Vault. In this article we will show you how this can be done.


Create a Key Vault in Azure

1. Create an application in Azure. Write down the tenantId, clientId, and clientSecret values.

2. Sign in to Azure and create a subscription. You need to specify a subscription name and select a billing account.

Further information:

3. Return to the portal homepage and proceed to Key Vaults. Click ‘Create’. Select a subscription, select a Resource group (or create a new one). Enter the name of the Key Vault.

4. Now it’s time to grant access permissions. Under the Key Vault you just created, proceed to ‘Access control (IAM)’. Add -> Add Role Assignment, select ‘Key Vault Certificates Officer’ using search option, click ‘Next’. Select ‘User, group, or service principal’

Click ‘Select members’, search for your app name and select it. . Find your app (not user) in the search bar on the right. Next, Review + assign.

Permissions may take a little time to take effect, but in our situation they worked right away.

5. Create a secret. The secret is the actual object that stores the sensitive information, the database password in our case. Select your Key Vault and under Objects -> Secrets -> Generate/Import enter the secret name (“pass” in our case) and its value.

Now we are ready to use this in our code.

Using Key Vault in PHPRunner

1. Under Style Editor -> Custom Files add a new file called keyvault.php. Paste the code below and use your own tenantId, clientId, and clientSecret values.

2. Example of using Key Vault in your application. We will create a new Database Server Connection and will retrieve the database password from Key Vault. In this example we use a MySQL database.

Using Key Vault in ASPRunner.NET

1. Under Style Editor -> Custom Files add a new file called keyvault.cs. Paste the code below and use your own tenantId, clientId, and clientSecret values.

2. In the BeforeConnect event, use the following code:



Teknologi Terkini

Agen Togel Terpercaya

Bandar Togel

Sabung Ayam Online

Berita Terkini

Artikel Terbaru

Berita Terbaru

Penerbangan

Berita Politik

Berita Politik

Software

Software Download

Download Aplikasi

Berita Terkini

News

Jasa PBN

Jasa Artikel

News

Breaking News

Berita