为 Azure 应用服务配置部署凭据Configure deployment credentials for Azure App Service

Azure 应用服务支持两种类型的凭据,这些凭据适用于本地 GIT 部署FTP/S 部署Azure App Service supports two types of credentials for local Git deployment and FTP/S deployment. 这些凭据与 Azure Active Directory 凭据不同。These credentials are not the same as your Azure Active Directory credentials.

  • 用户级凭据:一组适用于整个 Azure 帐户的凭据。User-level credentials: one set of credentials for the entire Azure account. 在任何订阅中,它均可用于为 Azure 帐户有权访问的任何应用部署应用服务。It can be used to deploy to App Service for any app, in any subscription, that the Azure account has permission to access. 这是在门户 GUI(例如应用的资源页的“概览”和“属性”)中呈现的默认组。 It's the default set that's surfaced in the portal GUI (such as the Overview and Properties of the app's resource page). 当通过基于角色的访问控制 (RBAC) 或共同管理员权限授予用户应用访问权限时,该用户便可使用其用户级别的凭据直到被撤销访问权限。When a user is granted app access via Role-Based Access Control (RBAC) or coadmin permissions, that user can use his/her own user-level credentials until the access is revoked. 请勿与其他 Azure 用户共享这些凭据。Do not share these credentials with other Azure users.

  • 应用级凭据:用于每个应用的一组凭据。App-level credentials: one set of credentials for each app. 只能使用它部署到该应用。It can be used to deploy to that app only. 每个应用的凭据在其创建时自动生成。The credentials for each app are generated automatically at app creation. 这些凭据不能手动进行配置,但可随时进行重置。They can't be configured manually, but can be reset anytime. 如果要通过 (RBAC) 授予用户访问应用级别凭据的权限,该用户必须是应用的参与者或更高级别身份。For a user to be granted access to app-level credentials via (RBAC), that user must be contributor or higher on the app. 读者不可进行发布,因此无法访问这些凭据。Readers are not allowed to publish, and can't access those credentials.

设置和重置用户级凭据Set and reset user-level credentials

可以在任何应用的资源页面中配置用户级凭据。You can configure your user-level credentials in any app's resource page. 无论在哪个应用中配置这些凭据,这些凭据都适用于 Azure 帐户中的所有应用和所有订阅。Regardless in which app you configure these credentials, it applies to all apps and for all subscriptions in your Azure account.

若要配置用户级凭据,请执行以下操作:To configure your user-level credentials:

  1. Azure 门户中,单击左侧菜单中的“应用服务” > <any_app> > “部署中心” > “部署凭据” 。In the Azure portal, from the left menu, click App Services > <any_app> > Deployment center > Deployment credentials.

    在门户中,用户必须至少有一个应用,才能访问“部署凭据”页面。In the portal, you must have at least one app before you can access the deployment credentials page. 但使用 Azure CLI 时,可以在没有应用的情况下配置用户级凭据。However, with the Azure CLI, you can configure user-level credentials without an existing app.

  2. 单击“用户凭据”,配置用户名和密码,然后单击“保存凭据” 。Click User Credentials, configure the user name and password, and then click Save Credentials.

设置部署凭据后,可以在应用的 概述 中找到 Git部署用户名,Once you have set your deployment credentials, you can find the Git deployment username in your app's Overview,

以及在应用的“属性”中查找 FTP 部署用户名。 and FTP deployment username in your app's Properties.

Note

Azure 不会显示用户级部署密码。Azure does not show your user-level deployment password. 如果忘记密码,可以按照本部分的步骤重置凭据。If you forget the password, you can reset your credentials by following the steps in this section.

将用户级凭据用于 FTP/FTPSUse user-level credentials with FTP/FTPS

使用用户级凭据向 FTP/FTPS 终结点进行身份验证时需要使用以下格式的用户名:<app-name>\<user-name>Authenticating to an FTP/FTPS endpoint using user-level credentials requirers a username in the following format: <app-name>\<user-name>

由于用户级凭据链接到用户而不是特定资源,因此用户名必须采用此格式才能将登录操作定向到正确的应用终结点。Since user-level credentials are linked to the user and not a specific resource, the username must be in this format to direct the sign-in action to the right app endpoint.

设置和重置应用级凭据Get and reset app-level credentials

若要获取应用级凭据,请执行以下操作:To get the app-level credentials:

  1. Azure 门户中,单击左侧菜单中的“应用服务” > <any_app> > “部署中心” > “部署凭据” 。In the Azure portal, from the left menu, click App Services > <any_app> > Deployment center > Deployment credentials.

  2. 单击“应用凭据”,然后单击“复制”链接以复制用户名或密码 。Click App Credentials, and click the Copy link to copy the username or password.

若要重置应用级别凭据,请单击相同对话框中的“重置凭据” 。To reset the app-level credentials, click Reset Credentials in the same dialog.

后续步骤Next steps

了解如何使用这些凭据通过本地 GitFTP/S 部署应用。Find out how to use these credentials to deploy your app from local Git or using FTP/S.