Skip to content

Azure OpenAI 凭据#

¥Azure OpenAI credentials

你可以使用以下凭据验证以下节点:

¥You can use these credentials to authenticate the following nodes:

¥Embeddings Azure OpenAI

先决条件#

¥Prerequisites

¥Create an Azure subscription.

¥Access to Azure OpenAI within that subscription. You may need to request access if your organization doesn't yet have it.

支持的身份验证方法#

¥Supported authentication methods

  • API 密钥

¥API key

  • Azure 入口 ID (OAuth2)

¥Azure Entra ID (OAuth2)

相关资源#

¥Related resources

有关服务的更多信息,请参阅 Azure OpenAI API 文档

¥Refer to Azure OpenAI's API documentation for more information about the service.

使用 API 密钥#

¥Using API key

要配置此凭据,你需要:

¥To configure this credential, you'll need:

  • 资源名称:资源名称

¥A Resource Name: the Name you give the resource

  • API 密钥:密钥 1 运行良好。可以在部署前的“密钥和端点”中访问此功能。

¥An API key: Key 1 works well. This can be accessed before deployment in Keys and Endpoint.

¥The API Version the credentials should use. See the Azure OpenAI API preview lifecycle documentation for more information about API versioning in Azure OpenAI.

要获取上述信息,请使用 创建并部署 Azure OpenAI 服务资源

¥To get the information above, create and deploy an Azure OpenAI Service resource.

Model name for Azure OpenAI nodes

部署资源后,请使用部署名称作为使用此凭据的 Azure OpenAI 节点的模型名称。

¥Once you deploy the resource, use the Deployment name as the model name for the Azure OpenAI nodes where you're using this credential.

使用 Azure 入口 ID (OAuth2)#

¥Using Azure Entra ID (OAuth2)

Note for n8n Cloud users

Cloud users don't need to provide connection details. Select Connect my account to connect through your browser.

对于自托管用户,从头开始配置 OAuth2 主要分为两个步骤:

¥For self-hosted users, there are two main steps to configure OAuth2 from scratch:

  1. 注册应用 使用 Microsoft Identity Platform。

¥Register an application with the Microsoft Identity Platform. 2. 该应用的 生成客户端密钥

¥Generate a client secret for that application.

请按照以下每个步骤的详细说明进行操作。有关 Microsoft OAuth2 Web 流程的更多详细信息,请参阅 Microsoft 身份验证和授权基础知识

¥Follow the detailed instructions for each step below. For more detail on the Microsoft OAuth2 web flow, refer to Microsoft authentication and authorization basics.

注册应用#

¥Register an application

使用 Microsoft Identity Platform 注册应用:

¥Register an application with the Microsoft Identity Platform:

  1. 打开 Microsoft 应用注册门户

¥Open the Microsoft Application Registration Portal. 2. 选择“注册应用”。

¥Select Register an application. 3. 输入应用名称。

¥Enter a Name for your app. 4. 在“支持的账户类型”中,选择“任何组织目录中的账户(任何 Azure AD 目录 - 多租户)和个人 Microsoft 账户(例如 Skype、Xbox)”。

¥In Supported account types, select Accounts in any organizational directory (Any Azure AD directory - Multi-tenant) and personal Microsoft accounts (for example, Skype, Xbox). 5. 在“注册应用”中:

¥In Register an application: 1. 从你的 n8n 凭据复制 OAuth 回调 URL。

1
  ¥Copy the **OAuth Callback URL** from your n8n credential.
  1. 将其粘贴到“重定向 URI(可选)”字段中。

    ¥Paste it into the Redirect URI (optional) field. 3. 选择“选择平台”>“Web”。

    ¥Select Select a platform > Web. 6. 选择“注册”以完成应用创建。

¥Select Register to finish creating your application. 7. 复制应用 ID 并将其作为客户端 ID 输入到你的 n8n 凭据中。

¥Copy the Application (client) ID and paste it into n8n as the Client ID.

有关更多信息,请参阅 使用 Microsoft Identity Platform 注册应用

¥Refer to Register an application with the Microsoft Identity Platform for more information.

生成客户端密钥#

¥Generate a client secret

创建应用后,为其生成客户端密钥:

¥With your application created, generate a client secret for it:

  1. 在你的 Microsoft 应用页面上,选择左侧导航栏中的“证书和密钥”。

¥On your Microsoft application page, select Certificates & secrets in the left navigation. 2. 在“客户端密钥”中,选择“+ 新建客户端密钥”。

¥In Client secrets, select + New client secret. 3. 输入你的客户密钥的描述,例如 n8n credential

¥Enter a Description for your client secret, such as n8n credential. 4. 选择添加。

¥Select Add. 5. 复制“值”列中的密钥。

¥Copy the Secret in the Value column. 6. 将其作为“客户端密钥”粘贴到 n8n 中。

¥Paste it into n8n as the Client Secret. 7. 在 n8n 中选择“连接我的账户”以完成连接设置。

¥Select Connect my account in n8n to finish setting up the connection. 8. 登录你的 Microsoft 账户并允许应用访问你的信息。

¥Log in to your Microsoft account and allow the app to access your info.

有关添加客户端密钥的更多信息,请参阅 Microsoft 的 添加凭据 文档。

¥Refer to Microsoft's Add credentials for more information on adding a client secret.

设置自定义范围#

¥Setting custom scopes

Azure Entra ID 凭据默认使用以下范围:

¥Azure Entra ID credentials use the following scopes by default:

要为你的凭据选择不同的范围,请启用“自定义范围”滑块并编辑“已启用范围”列表。请注意,在更严格的范围下,某些功能可能无法按预期工作。

¥To select different scopes for your credentials, enable the Custom Scopes slider and edit the Enabled Scopes list. Keep in mind that some features may not work as expected with more restrictive scopes.