Using Azure Key Vault to store connection strings – Xlinesoft Blog
Azure Key Vault provides secure storage for sensitive information such as passwords, secrets, etc. If you host your PHPRunner or ASPRunner.NET application in Azure, it makes sense to store your connection strings in Key Vault. In this article we will show you how this can be done.
Creating Key Vault in Azure
1. Create an application in Azure. Note the tenantId, clientId, and clientSecret values.
2. Sign in to Azure and create a subscription. You must specify a subscription name and select a billing account.
More information:
3. Go back to the start of the portal and go 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 assign access permissions. In the keybox you just created, go to “Access Control (IAM)”. Add -> Add Role Assignment, select “Vault Key Certificate Officer” using the search option, click “Next”. Select “User, Group, or Service Principal”
Click “Select Members” find your app name and select it. . Search for your app (not the user) in the search bar on the right. Then review + assign.
Permissions can take a while to apply, but in our situation it worked immediately.
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 in Objects -> Secrets -> Generate/Import enter the name of the secret (“pass” in our case) and its value.
Now we are ready to use this in our code.
Using Key Vault in PHPRunner
1. In 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. An example of using Key Vault in your application. We will create a new server database connection and retrieve the password from the Key Vault database. In this example we use the MySQL database.
Using Key Vault in ASPRunner.NET
1. In 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:
Technology
Berita Olahraga
Lowongan Kerja
Berita Terkini
Berita Terbaru
Berita Teknologi
Seputar Teknologi
Berita Politik
Resep Masakan
Pendidikan
Related Post
- June 6, 2025
- by anak
- 0
- 3:18 am
MDB5 REACT V.4.2.0
[ad_1] New time components of time and cuts, errors solutions, improvements and more [ad_2] Technology…
- November 27, 2024
- by anak
- 0
- 4:53 am