<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Azure 身份验证 on Dapr 文档库</title><link>https://v1-18.docs.dapr.io/zh-hans/developing-applications/integrations/azure/azure-authentication/</link><description>Recent content in Azure 身份验证 on Dapr 文档库</description><generator>Hugo</generator><language>zh-hans</language><atom:link href="https://v1-18.docs.dapr.io/zh-hans/developing-applications/integrations/azure/azure-authentication/index.xml" rel="self" type="application/rss+xml"/><item><title>Azure 身份验证</title><link>https://v1-18.docs.dapr.io/zh-hans/developing-applications/integrations/azure/azure-authentication/authenticating-azure/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/zh-hans/developing-applications/integrations/azure/azure-authentication/authenticating-azure/</guid><description>&lt;p>大多数 Dapr 的 Azure 组件支持使用 Microsoft Entra ID 进行身份验证。通过这种方式：&lt;/p>
&lt;ul>
&lt;li>管理员可以充分利用 Azure 基于角色的访问控制 (RBAC) 的精细权限。&lt;/li>
&lt;li>在 Azure 服务（如 Azure 容器应用、Azure Kubernetes 服务、Azure 虚拟机或其他 Azure 平台服务）上运行的应用程序可以使用 &lt;a href="https://learn.microsoft.com/azure/active-directory/managed-identities-azure-resources/overview">托管身份 (MI)&lt;/a> 和 &lt;a href="https://learn.microsoft.com/azure/aks/workload-identity-overview">工作负载身份&lt;/a>。这些功能使您的应用程序能够在不需要管理敏感凭据的情况下进行身份验证。&lt;/li>
&lt;/ul>
&lt;h2 id="关于-microsoft-entra-id-的身份验证">关于 Microsoft Entra ID 的身份验证&lt;/h2>
&lt;p>Microsoft Entra ID 是 Azure 的身份和访问管理 (IAM) 解决方案，用于对用户和服务进行身份验证和授权。&lt;/p>
&lt;p>Microsoft Entra ID 基于 OAuth 2.0 等开放标准，允许服务（应用程序）获取访问令牌以请求 Azure 服务，包括 Azure 存储、Azure 服务总线、Azure 密钥保管库、Azure Cosmos DB、Azure PostgreSQL 数据库、Azure SQL 等。&lt;/p>
&lt;blockquote>
&lt;p>在 Azure 术语中，应用程序也被称为“服务主体”。&lt;/p>&lt;/blockquote>
&lt;p>一些 Azure 组件提供其他身份验证方法，例如基于“共享密钥”或“访问令牌”的系统。尽管这些方法在 Dapr 中是有效且受支持的，但建议尽可能使用 Microsoft Entra ID 对 Dapr 组件进行身份验证，以利用其众多优势，包括：&lt;/p></description></item><item><title>如何创建新的 Microsoft Entra ID 应用程序和服务主体</title><link>https://v1-18.docs.dapr.io/zh-hans/developing-applications/integrations/azure/azure-authentication/howto-aad/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/zh-hans/developing-applications/integrations/azure/azure-authentication/howto-aad/</guid><description>&lt;h2 id="先决条件">先决条件&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://azure.microsoft.com/free/">一个 Azure 订阅&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://docs.microsoft.com/cli/azure/install-azure-cli">Azure CLI&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://stedolan.github.io/jq/download/">jq&lt;/a>&lt;/li>
&lt;li>OpenSSL（默认包含在所有 Linux 和 macOS 系统中，以及 WSL 中）&lt;/li>
&lt;li>确保您使用的是 bash 或 zsh shell&lt;/li>
&lt;/ul>
&lt;h2 id="使用-azure-cli-登录-azure">使用 Azure CLI 登录 Azure&lt;/h2>
&lt;p>在新终端中，运行以下命令：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>az login
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>az account &lt;span style="color:#204a87">set&lt;/span> -s &lt;span style="color:#ce5c00;font-weight:bold">[&lt;/span>your subscription id&lt;span style="color:#ce5c00;font-weight:bold">]&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="创建-microsoft-entra-id-应用程序">创建 Microsoft Entra ID 应用程序&lt;/h3>
&lt;p>使用以下命令创建 Microsoft Entra ID 应用程序：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"># 应用程序 / 服务主体的友好名称&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000">APP_NAME&lt;/span>&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>&lt;span style="color:#4e9a06">&amp;#34;dapr-application&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"># 创建应用程序&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000">APP_ID&lt;/span>&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>&lt;span style="color:#204a87;font-weight:bold">$(&lt;/span>az ad app create --display-name &lt;span style="color:#4e9a06">&amp;#34;&lt;/span>&lt;span style="color:#4e9a06">${&lt;/span>&lt;span style="color:#000">APP_NAME&lt;/span>&lt;span style="color:#4e9a06">}&lt;/span>&lt;span style="color:#4e9a06">&amp;#34;&lt;/span> &lt;span style="color:#000;font-weight:bold">|&lt;/span> jq -r .appId&lt;span style="color:#204a87;font-weight:bold">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>选择传递凭据的方式。&lt;/p>






&lt;ul class="nav nav-tabs" id="tabs-0" role="tablist">
 &lt;li class="nav-item">
 &lt;button class="nav-link active"
 id="tabs-00-00-tab" data-bs-toggle="tab" data-bs-target="#tabs-00-00" role="tab"
 data-td-tp-persist="客户端密钥" aria-controls="tabs-00-00" aria-selected="true">
 客户端密钥
 &lt;/button>
 &lt;/li>&lt;li class="nav-item">
 &lt;button class="nav-link"
 id="tabs-00-01-tab" data-bs-toggle="tab" data-bs-target="#tabs-00-01" role="tab"
 data-td-tp-persist="pfx 证书" aria-controls="tabs-00-01" aria-selected="false">
 PFX 证书
 &lt;/button>
 &lt;/li>
&lt;/ul>

&lt;div class="tab-content" id="tabs-0-content">
 &lt;div class="tab-body tab-pane fade show active"
 id="tabs-00-00" role="tabpanel" aria-labelled-by="tabs-00-00-tab" tabindex="0">
 &lt;p>要创建一个&lt;strong>客户端密钥&lt;/strong>，运行以下命令。&lt;/p></description></item><item><title>如何使用托管身份</title><link>https://v1-18.docs.dapr.io/zh-hans/developing-applications/integrations/azure/azure-authentication/howto-mi/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/zh-hans/developing-applications/integrations/azure/azure-authentication/howto-mi/</guid><description>&lt;p>托管身份可以自动进行身份验证，因为您的应用程序运行在具有系统分配或用户分配身份的 Azure 服务上。&lt;/p>
&lt;p>要开始使用，您需要在各种 Azure 服务中启用托管身份作为服务选项/功能，这与 Dapr 无关。启用后，会在后台为 Microsoft Entra ID（以前称为 Azure Active Directory ID）创建一个身份（或应用程序）。&lt;/p>
&lt;p>然后，您的 Dapr 服务可以利用该身份与 Microsoft Entra ID 进行认证，过程是透明的，您无需指定任何凭据。&lt;/p>
&lt;p>在本指南中，您将学习如何：&lt;/p>
&lt;ul>
&lt;li>通过官方 Azure 文档将您的身份授予您正在使用的 Azure 服务&lt;/li>
&lt;li>在您的组件中设置系统管理或用户分配身份&lt;/li>
&lt;/ul>
&lt;p>以上是全部内容。&lt;/p>


&lt;div class="alert alert-primary" role="alert">
&lt;h4 class="alert-heading">注意&lt;/h4>

 在您的组件 YAML 中，如果使用用户分配身份，您只需要 &lt;a href="https://v1-18.docs.dapr.io/zh-hans/developing-applications/integrations/azure/azure-authentication/authenticating-azure/#authenticating-with-managed-identities-mi">&lt;code>azureClientId&lt;/code> 属性&lt;/a>。否则，您可以省略此属性，默认使用系统管理身份。

&lt;/div>

&lt;h2 id="授予服务访问权限">授予服务访问权限&lt;/h2>
&lt;p>为特定 Azure 资源（由资源范围标识）设置必要的 Microsoft Entra ID 角色分配或自定义权限给您的系统管理或用户分配身份。&lt;/p>
&lt;p>您可以为新的或现有的 Azure 资源设置托管身份。说明取决于所使用的服务。请查看以下官方文档以获取最合适的说明：&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://docs.microsoft.com/azure/aks/use-managed-identity">Azure Kubernetes Service (AKS)&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://learn.microsoft.com/azure/container-apps/dapr-components?tabs=yaml#using-managed-identity">Azure Container Apps (ACA)&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://docs.microsoft.com/azure/app-service/overview-managed-identity">Azure App Service&lt;/a>（包括 Azure Web Apps 和 Azure Functions）&lt;/li>
&lt;li>&lt;a href="https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/qs-configure-cli-windows-vm">Azure Virtual Machines (VM)&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/qs-configure-cli-windows-vmss">Azure Virtual Machines Scale Sets (VMSS)&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://docs.microsoft.com/azure/container-instances/container-instances-managed-identity">Azure Container Instance (ACI)&lt;/a>&lt;/li>
&lt;/ul>
&lt;p>在为您的 Azure 资源分配系统管理身份后，您将获得如下信息：&lt;/p></description></item></channel></rss>