You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Store access credentials securely on an Azure Data Science Virtual Machine
17
18
18
-
It's common for the code in cloud applications to contain credentials for authenticating to cloud services. How to manage and secure these credentials is a well-known challenge in building cloud applications. Ideally, credentials should never appear on developer workstations or get checked in to source control.
19
+
Cloud application code often contains credentials to authenticate to cloud services. Management and security of these credentials is a well-known challenge as we build cloud applications. Ideally, credentials should never appear on developer workstations. We should never check in credentials to source control.
19
20
20
-
The [managed identities for Azure resources](../../active-directory/managed-identities-azure-resources/overview.md) feature makes solving this problem simpler by giving Azure services an automatically managed identity in Microsoft Entra ID. You can use this identity to authenticate to any service that supports Microsoft Entra authentication without having any credentials in your code.
21
+
The [managed identities for Azure resources](../../active-directory/managed-identities-azure-resources/overview.md) feature helps solve the problem. It gives Azure services an automatically managed identity in Microsoft Entra ID. You can use this identity to authenticate to any service that supports Microsoft Entra authentication. Additionally, this identity avoids placement of any embedded credentials in your code.
21
22
22
-
One way to secure credentials is to use Windows Installer (MSI) in combination with [Azure Key Vault](../../key-vault/index.yml), a managed Azure service to store secrets and cryptographic keys securely. You can access a key vault by using the managed identity and then retrieve the authorized secrets and cryptographic keys from the key vault.
23
+
To secure credentials, use Windows Installer (MSI) in combination with [Azure Key Vault](../../key-vault/index.yml). Azure Key Vault is a managed Azure service that securely stores secrets and cryptographic keys. You can access a key vault by using the managed identity and then retrieve the authorized secrets and cryptographic keys from the key vault.
23
24
24
-
The documentation about managed identities for Azure resources and Key Vault comprises a comprehensive resource for in-depth information on these services. The rest of this article walks through the basic use of MSI and Key Vault on the Data Science Virtual Machine (DSVM) to access Azure resources.
25
+
The documentation about Key Vault and managed identities for Azure resources forms a comprehensive resource for in-depth information about these services. This article walks through the basic use of MSI and Key Vault on the Data Science Virtual Machine (DSVM) to access Azure resources.
25
26
26
27
## Create a managed identity on the DSVM
27
28
28
29
```azurecli-interactive
29
-
# Prerequisite: You have already created a Data Science VM in the usual way.
30
+
# Prerequisite: You already created a Data Science VM in the usual way.
30
31
31
32
# Create an identity principal for the VM.
32
33
az vm assign-identity -g <Resource Group Name> -n <Name of the VM>
@@ -37,7 +38,7 @@ az resource list -n <Name of the VM> --query [*].identity.principalId --out tsv
37
38
## Assign Key Vault access permissions to a VM principal
38
39
39
40
```azurecli-interactive
40
-
# Prerequisite: You have already created an empty Key Vault resource on Azure by using the Azure portal or Azure CLI.
41
+
# Prerequisite: You already created an empty Key Vault resource on Azure through use of the Azure portal or Azure CLI.
41
42
42
43
# Assign only get and set permissions but not the capability to list the keys.
43
44
az keyvault set-policy --object-id <Principal ID of the DSVM from previous step> --name <Key Vault Name> -g <Resource Group of Key Vault> --secret-permissions get set
# Prerequisite: You have granted your VMs MSI access to use storage account access keys based on instructions at https://learn.microsoft.com/azure/active-directory/managed-service-identity/tutorial-linux-vm-access-storage. This article describes the process in more detail.
61
+
# Prerequisite: You granted your VMs MSI access to use storage account access keys, based on instructions at https://learn.microsoft.com/azure/active-directory/managed-service-identity/tutorial-linux-vm-access-storage. This article describes the process in more detail.
@@ -98,10 +99,10 @@ print("My secret value is {}".format(secret.value))
98
99
## Access the key vault from Azure CLI
99
100
100
101
```azurecli-interactive
101
-
# With managed identities for Azure resources set up on the DSVM, users on the DSVM can use Azure CLI to perform the authorized functions. The following commands enable access to the key vault from Azure CLI without requiring login to an Azure account.
102
-
# Prerequisites: MSI is already set up on the DSVM as indicated earlier. Specific permissions, like accessing storage account keys, reading specific secrets, and writing new secrets, are provided to the MSI.
102
+
# With managed identities for Azure resources set up on the DSVM, users on the DSVM can use Azure CLI to perform the authorized functions. The following commands enable access to the key vault from Azure CLI, without a required Azure account login.
103
+
# Prerequisites: MSI is already set up on the DSVM, as indicated earlier. Specific permissions, like accessing storage account keys, reading specific secrets, and writing new secrets, are provided to the MSI.
103
104
104
-
# Authenticate to Azure CLI without requiring an Azure account.
105
+
# Authenticate to Azure CLI without a required Azure account.
105
106
az login --msi
106
107
107
108
# Retrieve a secret from the key vault.
@@ -112,4 +113,4 @@ az keyvault secret set --name MySecret --vault-name <Vault Name> --value "Hellow
112
113
113
114
# List access keys for the storage account.
114
115
az storage account keys list -g <Storage Account Resource Group> -n <Storage Account Name>
0 commit comments