Skip to content

Commit 582c23c

Browse files
authored
Merge pull request #206865 from mumian/0803-bicep-pipeline
add AzureResourceGroupDeployment sample
2 parents 080bb1e + cacd661 commit 582c23c

File tree

2 files changed

+47
-9
lines changed

2 files changed

+47
-9
lines changed

articles/azure-resource-manager/bicep/add-template-to-azure-pipelines.md

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: CI/CD with Azure Pipelines and Bicep files
33
description: In this quickstart, you learn how to configure continuous integration in Azure Pipelines by using Bicep files. It shows how to use an Azure CLI task to deploy a Bicep file.
44
ms.topic: quickstart
5-
ms.date: 02/23/2022
5+
ms.date: 08/03/2022
66
---
77

88
# Quickstart: Integrate Bicep with Azure Pipelines
@@ -39,7 +39,50 @@ You need a [Bicep file](./quickstart-create-bicep-use-visual-studio-code.md) tha
3939

4040
![Select pipeline](./media/add-template-to-azure-pipelines/select-pipeline.png)
4141

42-
## Azure CLI task
42+
## Deploy Bicep files
43+
44+
You can use Azure Resource Group Deployment task or Azure CLI task to deploy a Bicep file.
45+
46+
### Use Azure Resource Group Deployment task
47+
48+
Replace your starter pipeline with the following YAML. It creates a resource group and deploys a Bicep file by using an [Azure Resource Group Deployment task](/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment):
49+
50+
```yml
51+
trigger:
52+
- master
53+
54+
name: Deploy Bicep files
55+
56+
variables:
57+
vmImageName: 'ubuntu-latest'
58+
59+
azureServiceConnection: '<your-connection-name>'
60+
resourceGroupName: 'exampleRG'
61+
location: '<your-resource-group-location>'
62+
templateFile: './main.bicep'
63+
pool:
64+
vmImage: $(vmImageName)
65+
66+
steps:
67+
- task: AzureResourceManagerTemplateDeployment@3
68+
inputs:
69+
deploymentScope: 'Resource Group'
70+
azureResourceManagerConnection: '$(azureServiceConnection)'
71+
action: 'Create Or Update Resource Group'
72+
resourceGroupName: '$(resourceGroupName)'
73+
location: '$(location)'
74+
templateLocation: 'Linked artifact'
75+
csmFile: '$(templateFile)'
76+
overrideParameters: '-storageAccountType Standard_LRS'
77+
deploymentMode: 'Incremental'
78+
deploymentName: 'DeployPipelineTemplate'
79+
```
80+
81+
For the descriptions of the task inputs, see [Azure Resource Group Deployment task](/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment).
82+
83+
Select **Save**. The build pipeline automatically runs. Go back to the summary for your build pipeline, and watch the status.
84+
85+
### Use Azure CLI task
4386
4487
Replace your starter pipeline with the following YAML. It creates a resource group and deploys a Bicep file by using an [Azure CLI task](/azure/devops/pipelines/tasks/deploy/azure-cli):
4588
@@ -71,12 +114,7 @@ steps:
71114
az deployment group create --resource-group $(resourceGroupName) --template-file $(templateFile)
72115
```
73116
74-
The Azure CLI task takes the following inputs:
75-
76-
* `azureSubscription`, provide the name of the service connection that you created. See [Prerequisites](#prerequisites).
77-
* `scriptType`, use **bash**.
78-
* `scriptLocation`, use **inlineScript**, or **scriptPath**. If you specify **scriptPath**, you'll also need to specify a `scriptPath` parameter.
79-
* `inlineScript`, specify your script lines. The script provided in the sample deploys a Bicep file called *main.bicep*.
117+
For the descriptions of the task inputs, see [Azure CLI task](/azure/devops/pipelines/tasks/deploy/azure-cli).
80118
81119
Select **Save**. The build pipeline automatically runs. Go back to the summary for your build pipeline, and watch the status.
82120

articles/azure-resource-manager/bicep/toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
- name: CI/CD
3232
items:
3333
- name: Bicep with pipelines
34-
displayName: continuous, ci, cd, CI/CD
34+
displayName: continuous,ci,cd,CI/CD,AzureResourceGroupDeployment,AzureCLI
3535
href: add-template-to-azure-pipelines.md
3636
- name: Bicep with GitHub Actions
3737
displayName: continuous, ci, cd, CI/CD

0 commit comments

Comments
 (0)