azure - 使用 Azure DevOps 跨环境部署 Azure 资源

标签 azure azure-devops devops azure-resource-manager

我创建了一个资源组以及其中的各种资源。在资源中,我有 ADF 和管道、SQL Server、数据库和对象、逻辑应用程序、AAS 模型、存储帐户等。

现在我想将我的所有信息 checkin 源代码管理以进行版本控制。我也有 Azure DevOps。我的需求是我想将资源和对象部署到另一个环境中。

例如我有一个开发环境。我在资源组中创建了所有资源。在构建这个环境时,我没有使用任何模板或源代码控制。我现在有了 Azure DevOps。现在我想从开发环境构建测试设置。我如何实现这一目标?

感谢任何帮助。谢谢。

最佳答案

您可以首先从 Azure 资源组门户导出模板。见下文:

1、进入Azure资源组门户-->点击自动化下的导出模板-->下载

enter image description here

您还可以使用 Az cli/Azure powershell 导出模板。请参阅示例命令 here

请查看文档here了解有关如何使用 ARM 模板管理 Azure 资源的详细信息。

2、将上面步骤中下载的ARM模板同步到您的azure存储库。

3、创建azure Resource Manager service connection将 Azure 订阅连接到 Azure DevOps。请参阅this thread举个例子。

4、创建azure devops pipeline自动化 Azure 资源部署。

5、添加Azure Resource Manager (ARM) Template Deployment Task在您的 azure 管道中部署第一步中导出的模板。

steps:
- task: AzureResourceManagerTemplateDeployment@3
  displayName: 'ARM Template deployment: Resource Group scope'
  inputs:
    azureResourceManagerConnection: 'azuresubscriptionServiceConnection'
    subscriptionId: '......'
    resourceGroupName: 'Resource-group'
    location: 'East US'
    csmFile: template.json
    csmParametersFile: parameters.json

上面只是向您提供了通过 azure devops 管道部署 azure 资源时需要执行的一般步骤。您需要自行探索文档,以了解如何自定义管道、如何创建 ARM 模板以及如何使用 AzureResourceManagerTemplateDeployment 任务。

关于azure - 使用 Azure DevOps 跨环境部署 Azure 资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65784183/

相关文章:

asp.net-mvc-4 - 用于云服务的 Azure 包中缺少 Mvc View

git - Azure DevOps/VSTS 总是在干净的存储库上报告 "DETACHED HEAD"

Azure DevOps YAML 模板传递哈希集/映射/字典/对象 - 键值?

chef-infra - 将 Chef 服务器迁移到另一台服务器

hadoop - Hadoop Admin和Hadoop DevOps有什么区别

Azure Web 作业在应用程序服务中的辅助插槽中交换

entity-framework - 序列化 Azure 缓存的 Entity Framework 对象

azure - 如何修复 azure PowerShell : "Can not remove tag/tag value because it' s being referenced by other resources. 中的此错误“

c# - 将现有 MVC4 项目移动到 Visual Studio Online

python - 如何设置 docker ,但在准备好新容器之前使容器保持事件状态