【发布时间】:2018-03-22 10:40:41
【问题描述】:
要在 Azure 中运行应用程序,我需要在 Azure AD 中创建一个应用程序和一个相应的服务主体。然后我的应用程序针对这个 App/Principal 对进行身份验证。要进行身份验证,我可以在应用注册中创建一个应用程序密钥,或者我可以在服务主体中创建一个密码(以及其他选项)。从实际角度看有什么区别?
例如,无论 $key 是应用程序的密钥还是服务主体的密码,这段代码的运行方式完全相同(从外部):
$key = ConvertTo-SecureString $authKeyOrPassword -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($appID, $key)
Add-AzureRmAccount -Credential $cred -TenantId $tenantID -ServicePrincipal
什么时候应该对应用进行身份验证,什么时候应该使用服务主体?
【问题讨论】:
标签: azure azure-active-directory azure-authentication azure-security service-principal