Skip to content

Commit 00c86c3

Browse files
authored
Merge pull request #114775 from ShaneBala-keyvault/master
updating based on github feedback
2 parents e00e111 + eff4510 commit 00c86c3

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

articles/key-vault/general/tutorial-python-windows-virtual-machine.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
title: Tutorial - Use Azure Key Vault with a Windows virtual machine in Python | Microsoft Docs
33
description: In this tutorial, you configure an ASP.NET core application to read a secret from your key vault.
44
services: key-vault
5-
author: msmbaldwin
6-
manager: rajvijan
5+
author: ShaneBala-keyvault
6+
manager: ravijan
77

88
ms.service: key-vault
99
ms.subservice: general
1010
ms.topic: tutorial
11-
ms.date: 09/05/2018
12-
ms.author: mbaldwin
11+
ms.date: 05/11/2020
12+
ms.author: sudbalas
1313
ms.custom: mvc
1414
#Customer intent: As a developer I want to use Azure Key vault to store secrets for my app, so that they are kept secure.
1515
---
@@ -149,7 +149,10 @@ The code presents a two-step process:
149149
# importing the requests library
150150
import requests
151151

152-
# Step 1: Fetch an access token from a Managed Identity enabled azure resource.
152+
# Step 1: Fetch an access token from a Managed Identity enabled azure resource.
153+
# Resources with an MSI configured recieve an AAD access token by using the Azure Instance Metadata Service (IMDS)
154+
# IMDS provides an endpoint accessible to all IaaS VMs using a non-routable well-known IP Address
155+
# To learn more about IMDS and MSI Authentication see the following link: https://docs.microsoft.com/azure/virtual-machines/windows/instance-metadata-service
153156
# Note that the resource here is https://vault.azure.net for public cloud and api-version is 2018-02-01
154157
MSI_ENDPOINT = "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fvault.azure.net"
155158
r = requests.get(MSI_ENDPOINT, headers = {"Metadata" : "true"})
@@ -159,7 +162,7 @@ The code presents a two-step process:
159162
data = r.json()
160163

161164
# Step 2: Pass the access_token received from previous HTTP GET call to your key vault.
162-
KeyVaultURL = "https://prashanthwinvmvault.vault.azure.net/secrets/RandomSecret?api-version=2016-10-01"
165+
KeyVaultURL = "https://{YOUR KEY VAULT NAME}.vault.azure.net/secrets/{YOUR SECRET NAME}?api-version=2016-10-01"
163166
kvSecret = requests.get(url = KeyVaultURL, headers = {"Authorization": "Bearer " + data["access_token"]})
164167

165168
print(kvSecret.json()["value"])

0 commit comments

Comments
 (0)