如何从 ML OP 访问 Key Vault

问题描述

我在 Azure ML 工作区中运行了机器学习代码。使用 Azure MLops 管道通过推理集群部署了相同的代码。 Key-Vault 用于存储在 jupyter notebook 中访问的变量

While testing the endpoint from Postman getting "managedidentitycredential.get_token Failed: managedidentitycredential authentication unavailable,no managed identity endpoint found" error.

In code,trying to access key-vault variables by the below method.
credentials = DefaultAzureCredential()
client = SecretClient(vault_url="url",credential=credentials)
access_key = client.get_secret("KEY").value

Please help,how to access key vault here? 

Thanks.

解决方法

请参阅本示例中的“在远程运行中使用机密”部分以访问密钥保管库。

https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/manage-azureml-service/authentication-in-azureml/authentication-in-azureml.ipynb

使用 Azure 门户为 VM 上的 Azure 资源配置托管标识: https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/qs-configure-portal-windows-vm