您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

部署 Azure 逻辑应用的 Azure 资源管理器模板Deploy Azure Resource Manager templates for Azure Logic Apps

为逻辑应用创建 Azure 资源管理器模板之后,可以通过以下方式部署模板:After you create an Azure Resource Manager template for your logic app, you can deploy your template in these ways:

通过 Azure 门户部署Deploy through Azure portal

若要将逻辑应用模板自动部署到 Azure,你可以选择以下 "部署到 azure " 按钮,该按钮会登录到 Azure 门户并提示你输入逻辑应用的相关信息。To automatically deploy a logic app template to Azure, you can choose the following Deploy to Azure button, which signs you in to the Azure portal and prompts you for information about your logic app. 然后,你可以对逻辑应用模板或参数进行任何必要的更改。You can then make any necessary changes to the logic app template or parameters.

部署到 AzureDeploy to Azure

例如,登录到 Azure 门户后,系统会提示输入以下信息:For example, you're prompted for the following information after you sign in to the Azure portal:

  • Azure 订阅名称Azure subscription name
  • 要使用的资源组Resource group that you want to use
  • 逻辑应用位置Logic app location
  • 逻辑应用的名称The name for your logic app
  • 测试 URIA test URI
  • 接受指定的条款和条件Acceptance of the specified terms and conditions

有关详细信息,请参阅以下主题:For more information, see these topics:

使用 Visual Studio 进行部署Deploy with Visual Studio

若要从使用 Visual Studio 创建的 Azure 资源组项目部署逻辑应用模板,请执行以下步骤以手动将逻辑应用部署到 azure。To deploy a logic app template from an Azure Resource Group project that you created by using Visual Studio, follow these steps to manually deploy your logic app to Azure.

使用 Azure PowerShell 部署Deploy with Azure PowerShell

若要部署到特定的Azure 资源组,请使用以下命令:To deploy to a specific Azure resource group, use the following command:

New-AzResourceGroupDeployment -ResourceGroupName <Azure-resource-group-name> -TemplateUri https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-logic-app-create/azuredeploy.json

有关详细信息,请参阅以下主题:For more information, see these topics:

使用 Azure CLI 进行部署Deploy with Azure CLI

若要部署到特定的Azure 资源组,请使用以下命令:To deploy to a specific Azure resource group, use the following command:

az group deployment create -g <Azure-resource-group-name> --template-uri https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-logic-app-create/azuredeploy.json

有关详细信息,请参阅以下主题:For more information, see these topics:

用 Azure DevOps 部署Deploy with Azure DevOps

若要部署逻辑应用模板并管理环境,团队通常使用Azure DevOps中的工具,如Azure PipelinesTo deploy logic app templates and manage environments, teams commonly use a tool such as Azure Pipelines in Azure DevOps. Azure Pipelines 提供Azure 资源组部署任务,你可以将其添加到任何生成或发布管道。Azure Pipelines provides an Azure Resource Group Deployment task that you can add to any build or release pipeline. 为了获得部署和生成发布管道的授权,还需要 Azure Active Directory (AD)服务主体For authorization to deploy and generate the release pipeline, you also need an Azure Active Directory (AD) service principal. 详细了解如何将服务主体与 Azure Pipelines 结合使用Learn more about using service principals with Azure Pipelines.

有关包含 Azure Pipelines 的 Azure 资源管理器模板持续集成和持续部署(CI/CD)的详细信息,请参阅以下主题和示例:For more information about continuous integration and continuous deployment (CI/CD) for Azure Resource Manager templates with Azure Pipelines, see these topics and samples:

下面是使用 Azure Pipelines 的一般高级步骤:Here are the general high-level steps for using Azure Pipelines:

  1. 在 Azure Pipelines 中,创建一个空管道。In Azure Pipelines, create an empty pipeline.

  2. 选择管道所需的资源,例如逻辑应用模板和模板参数文件,您可以手动生成这些资源,也可以将其作为生成过程的一部分生成。Choose the resources you need for the pipeline, such as your logic app template and template parameters files, which you generate manually or as part of the build process.

  3. 对于代理作业,查找并添加Azure 资源组部署任务。For your agent job, find and add the Azure Resource Group Deployment task.

    添加 "Azure 资源组部署" 任务

  4. 使用服务主体进行配置。Configure with a service principal.

  5. 添加对逻辑应用模板和模板参数文件的引用。Add references to your logic app template and template parameters files.

  6. 继续在发布过程中根据需要为其他任何环境、自动测试或审批程序构建步骤。Continue to build out steps in the release process for any other environment, automated test, or approvers as needed.

授权 OAuth 连接Authorize OAuth connections

部署完成后,逻辑应用使用有效的参数以端到端的方式工作。After deployment, your logic app works end-to-end with valid parameters. 但是,你仍必须对任何 OAuth 连接授权以生成有效的访问令牌,以便对凭据进行身份验证However, you must still authorize any OAuth connections to generate valid access tokens for authenticating your credentials. 可以通过以下方法来授权 OAuth 连接:Here are ways that you can authorize OAuth connections:

  • 对于自动部署,您可以使用为每个 OAuth 连接提供许可的脚本。For automated deployments, you can use a script that provides consent for each OAuth connection. 下面是 GitHub 中LogicAppConnectionAuth项目的示例脚本。Here's an example script in GitHub in the LogicAppConnectionAuth project.

  • 若要手动授权 OAuth 连接,请在逻辑应用设计器中打开逻辑应用,不管是在 Azure 门户中还是在 Visual Studio 中。To manually authorize OAuth connections, open your logic app in Logic App Designer, either in the Azure portal or in Visual Studio. 在设计器中,授权任何所需的连接。In the designer, authorize any required connections.

如果改为使用 Azure Active Directory (Azure AD)服务主体来授权连接,请了解如何在逻辑应用模板中指定服务主体参数If you use an Azure Active Directory (Azure AD) service principal instead to authorize connections, learn how to specify service principal parameters in your logic app template.

后续步骤Next steps