MsiAuthentication 类
使用 Azure Active Directory 中的托管标识管理身份验证。
在 Azure 虚拟机 (VM) 上使用 Azure ML SDK 时,可以使用托管标识(以前称为托管服务标识 - MSI)进行身份验证。 使用托管标识允许 VM 连接到工作区,而无需在 Python 代码中存储凭据,从而将身份验证过程与任何特定的用户登录分离。
类 MsiAuthentication 构造函数。
- 继承
-
MsiAuthentication
构造函数
MsiAuthentication(cloud=None, **kwargs)
参数
- cloud
- str
目标云的名称。 可以是“AzureCloud”、“AzureChinaCloud”或“AzureUSGovernment”之一。 如未指定云,则使用 Azure CLI 中任何配置的默认值。 如果未找到默认值,则使用“AzureCloud”。
一个映射 {parameter_name: value}
,按其对象或资源 ID(如 {"client_id": "..."}
)指定用户分配的标识。 请查看托管环境的文档,了解其预期值。
- cloud
- str
目标云的名称。 可以是“AzureCloud”、“AzureChinaCloud”或“AzureUSGovernment”之一。 如未指定云,则使用 Azure CLI 中任何配置的默认值。 如果未找到默认值,则使用“AzureCloud”。
一个映射 {parameter_name: value}
,按其对象或资源 ID(如 {"client_id": "..."}
)指定用户分配的标识。 请查看托管环境的文档,了解其预期值。
注解
以下示例演示了如何使用 MsiAuthentication。
from azureml.core.authentication import MsiAuthentication
msi_auth = MsiAuthentication()
ws = Workspace(subscription_id="my-subscription-id",
resource_group="my-ml-rg",
workspace_name="my-ml-workspace",
auth=msi_auth)
print("Found workspace {} at location {}".format(ws.name, ws.location))
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈