为 Azure Stack Hub 上的应用服务配置部署源Configure deployment sources for App Services on Azure Stack Hub

Azure Stack Hub 上的应用服务支持从多个源代码管理提供程序执行按需部署。App Service on Azure Stack Hub supports on-demand deployment from multiple source control providers. 应用开发人员可以使用此功能直接从其源代码管理存储库部署。This feature lets app developers deploy directly from their source control repositories. 如果用户想要将应用服务配置为连接到其存储库,云操作员必须先在 Azure Stack Hub 上的应用服务与源代码管理提供程序之间配置集成。If users want to configure App Service to connect to their repositories, a cloud operator must first configure the integration between App Service on Azure Stack Hub and the source control provider.

除了本地 Git 以外,还支持以下源代码管理提供程序:In addition to local Git, the following source control providers are supported:

  • GitHubGitHub
  • BitBucketBitBucket
  • OneDriveOneDrive
  • DropBoxDropBox

在应用服务管理中查看部署源View deployment sources in App Service administration

  1. 以服务管理员身份登录到 Azure Stack Hub 管理员门户。Sign in to the Azure Stack Hub administrator portal as the service admin.

  2. 浏览到“所有服务”,然后选择“应用服务”。Browse to All Services and select the App Service.

    应用服务资源提供程序管理

  3. 选择“源代码管理配置”。Select Source control configuration. 可以看到所有已配置的部署源的列表。You can see the list of all configured deployment sources.

    应用服务资源提供程序管理中的源代码管理配置

配置 GitHubConfigure GitHub

必须具有 GitHub 帐户才能完成此任务。You must have a GitHub account to complete this task. 建议使用组织帐户,而不是个人帐户。You might want to use an account for your organization rather than a personal account.

  1. 登录到 GitHub,转到 https://www.github.com/settings/developers ,然后选择“注册新应用程序”。Sign in to GitHub, go to https://www.github.com/settings/developers, and then select Register a new application.

    GitHub - 注册新应用程序

  2. 输入应用程序名称Enter an Application name. 例如,Azure Stack Hub 上的应用服务For example, App Service on Azure Stack Hub.

  3. 输入“主页 URL”。Enter the Homepage URL. 主页 URL 必须是 Azure Stack Hub 门户地址。The Homepage URL must be the Azure Stack Hub portal address. 例如,https://portal.<region>.<FQDN>For example, https://portal.<region>.<FQDN>. 有关 Azure Stack Hub 的完全限定的域名 (FQDN) 的详细信息,请参阅 Azure Stack Hub DNS 命名空间For more information on the Azure Stack Hub fully qualified domain name (FQDN), see Azure Stack Hub DNS namespace.

  4. 输入应用程序说明Enter an Application Description.

  5. 输入“授权回调 URL”。Enter the Authorization callback URL. 在默认的 Azure Stack Hub 部署中,该 URL 采用 https://portal.<region>.<FQDN>/TokenAuthorize 格式。In a default Azure Stack Hub deployment, the URL is in the form https://portal.<region>.<FQDN>/TokenAuthorize.

  6. 选择“注册应用程序”。Select Register application. 此时会显示一个页面,其中列出了应用的“客户端 ID”和“客户端机密”。 A page is displayed listing the Client ID and Client Secret for the app.

    GitHub - 已完成应用程序注册

  7. 在新的浏览器标签页或窗口中,以服务管理员身份登录到 Azure Stack Hub 管理员门户。In a new browser tab or window, sign in to the Azure Stack Hub administrator portal as the service admin.

  8. 转到“资源提供程序”并选择“应用服务资源提供程序管理” 。Go to Resource Providers and select the App Service Resource Provider Admin.

  9. 选择“源代码管理配置”。Select Source control configuration.

  10. 将“客户端 ID”和“客户端机密”复制并粘贴到 GitHub 的相应输入框中。 Copy and paste the Client ID and Client Secret into the corresponding input boxes for GitHub.

  11. 选择“保存” 。Select Save.

配置 BitBucketConfigure BitBucket

必须具有 BitBucket 帐户才能完成此任务。You must have a BitBucket account to complete this task. 建议使用组织帐户,而不是个人帐户。You might want to use an account for your organization rather than a personal account.

  1. 登录到 BitBucket 并转到帐户下面的“集成”。Sign in to BitBucket and go to Integrations under your account.

    BitBucket 仪表板 - 集成

  2. 选择“访问管理”下面的“OAuth”,并选择“添加使用者” 。Select OAuth under Access Management and Add consumer.

    BitBucket - 添加 OAuth 使用者

  3. 输入使用者的名称Enter a Name for the consumer. 例如,Azure Stack Hub 上的应用服务For example, App Service on Azure Stack Hub.

  4. 为应用输入说明Enter a Description for the app.

  5. 输入“回调 URL”。Enter the Callback URL. 在默认的 Azure Stack Hub 部署中,该回调 URL 采用 https://portal.<region>.<FQDN>/TokenAuthorize 格式。In a default Azure Stack Hub deployment, the callback URL is in the form https://portal.<region>.<FQDN>/TokenAuthorize. 要使 BitBucket 集成成功,该 URL 的大小写必须与此处所列相同。For BitBucket integration to succeed, the URL must follow the capitalization listed here.

  6. 输入 URLEnter the URL. 此 URL 应是 Azure Stack Hub 门户的 URL。This URL should be the Azure Stack Hub portal URL. 例如,https://portal.<region>.<FQDN>For example, https://portal.<region>.<FQDN>.

  7. 选择所需权限Select the Permissions required:

    • 存储库读取Repositories: Read
    • Webhook读写Webhooks: Read and write
  8. 选择“保存” 。Select Save. 现在,“OAuth 使用者”下面会显示此新应用以及密钥机密You now see this new app, along with the Key and Secret, under OAuth consumers.

    BitBucket 应用程序列表

  9. 在新的浏览器标签页或窗口中,以服务管理员身份登录到 Azure Stack Hub 管理员门户。In a new browser tab or window, sign in to the Azure Stack Hub administrator portal as the service admin.

  10. 转到“资源提供程序”并选择“应用服务资源提供程序管理” 。Go to Resource Providers and select the App Service Resource Provider Admin.

  11. 选择“源代码管理配置”。Select Source control configuration.

  12. 将“密钥”和“机密”分别复制并粘贴到 BitBucket 的“客户端 ID”和“客户端机密”输入框。 Copy and paste the Key into the Client ID input box and Secret into the Client Secret input box for BitBucket.

  13. 选择“保存” 。Select Save.

配置 OneDriveConfigure OneDrive

必须将一个 Microsoft 帐户链接到 OneDrive 帐户才能完成此任务。You must have a Microsoft account linked to a OneDrive account to complete this task. 建议使用组织帐户,而不是个人帐户。You might want to use an account for your organization rather than a personal account.

备注

目前不支持 OneDrive for Business 帐户。OneDrive for business accounts are currently not supported.

  1. 转到 https://apps.dev.microsoft.com/?referrer=https%3A%2F%2Fdev.onedrive.com%2Fapp-registration.htm ,并使用 Microsoft 帐户登录。Go to https://apps.dev.microsoft.com/?referrer=https%3A%2F%2Fdev.onedrive.com%2Fapp-registration.htm and sign in using your Microsoft account.

  2. 在“我的应用程序”下,选择“添加应用” 。Under My applications, select Add an app.

    OneDrive 应用程序

  3. 输入新应用注册的名称,输入“Azure Stack Hub 上的应用服务”,然后选择“创建应用程序” 。Enter a Name for the new app registration: enter App Service on Azure Stack Hub and then select Create Application.

  4. 下一屏幕列出了新应用的属性。The next screen lists the properties of your new app. 将“应用程序 ID”保存到某个临时位置。Save the Application ID to a temporary location.

    OneDrive 应用程序属性

  5. 在“应用程序机密”下,选择“生成新密码” 。Under Application Secrets, select Generate New Password. 记下生成的新密码Make a note of the New password generated. 此密码是应用程序机密,选择“确定”后将不可检索。This password is your application secret and it's not retrievable after you select OK.

  6. 在“平台”下,选择“添加平台”,然后选择“Web” 。Under Platforms, select Add Platform and then select Web.

  7. 输入“重定向 URI”。Enter the Redirect URI. 在默认的 Azure Stack Hub 部署中,该重定向 URI 采用 https://portal.<region>.<FQDN>/TokenAuthorize 格式。In a default Azure Stack Hub deployment, the redirect URI is in the form https://portal.<region>.<FQDN>/TokenAuthorize.

    OneDrive 应用程序 - 添加 Web 平台

  8. 添加“Microsoft Graph 权限 - 委派权限”。Add the Microsoft Graph Permissions - Delegated Permissions.

    • Files.ReadWrite.AppFolderFiles.ReadWrite.AppFolder
    • User.Read OneDrive 应用程序 - Graph 权限User. Read OneDrive Application - Graph Permissions
  9. 选择“保存” 。Select Save.

  10. 在新的浏览器标签页或窗口中,以服务管理员身份登录到 Azure Stack Hub 管理员门户。In a new browser tab or window, sign in to the Azure Stack Hub administrator portal as the service admin.

  11. 转到“资源提供程序”并选择“应用服务资源提供程序管理” 。Go to Resource Providers and select the App Service Resource Provider Admin.

  12. 选择“源代码管理配置”。Select Source control configuration.

  13. 将“应用程序 ID”和“密码”分别复制并粘贴到 OneDrive 的“客户端 ID”和“客户端机密”输入框。 Copy and paste the Application ID into the Client ID input box and Password into the Client Secret input box for OneDrive.

  14. 选择“保存” 。Select Save.

配置 DropBoxConfigure DropBox

备注

必须使用一个 DropBox 帐户来完成此任务。You must have a DropBox account to complete this task. 建议使用组织帐户,而不是个人帐户。You might want to use an account for your organization rather than a personal account.

  1. 转到 https://www.dropbox.com/developers/apps ,并使用 DropBox 帐户凭据登录。Go to https://www.dropbox.com/developers/apps and sign in using your DropBox account credentials.

  2. 选择“创建应用”。Select Create app.

    Dropbox 应用

  3. 选择“DropBox API”。Select DropBox API.

  4. 将访问级别设置为“应用文件夹”。Set the access level to App Folder.

  5. 输入应用的名称Enter a Name for your app.

    Dropbox 应用程序注册

  6. 选择“创建应用”。Select Create App. 此时会出现一个页面,其中列出了应用的设置,包括应用密钥应用机密You're presented with a page listing the settings for the app, including App key and App secret.

  7. 确保“应用文件夹名称”设置为“Azure Stack Hub 上的应用服务” 。Make sure that the App folder name is set to App Service on Azure Stack Hub.

  8. 设置“OAuth 2 重定向 URI”,然后选择“添加” 。Set the OAuth 2 Redirect URI and then select Add. 在默认的 Azure Stack Hub 部署中,该重定向 URI 采用 https://portal.<region>.<FQDN>/TokenAuthorize 格式。In a default Azure Stack Hub deployment, the redirect URI is in the form https://portal.<region>.<FQDN>/TokenAuthorize.

    Dropbox 应用程序配置

  9. 在新的浏览器标签页或窗口中,以服务管理员身份登录到 Azure Stack Hub 管理员门户。In a new browser tab or window, sign in to the Azure Stack Hub administrator portal as the service admin.

  10. 转到“资源提供程序”并选择“应用服务资源提供程序管理” 。Go to Resource Providers and select the App Service Resource Provider Admin.

  11. 选择“源代码管理配置”。Select Source control configuration.

  12. 将“应用程序密钥”和“应用机密”分别复制并粘贴到 DropBox 的“客户端 ID”和“客户端机密”输入框。 Copy and paste the Application Key into the Client ID input box and App secret into the Client Secret input box for DropBox.

  13. 选择“保存” 。Select Save.

后续步骤Next steps

用户现在可以对本地 Git 部署等操作使用部署源。Users can now use the deployment sources for things like local Git deployment.