You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/aca/10-aca-iac-bicep/ci-cd-azdo.md
+29-20Lines changed: 29 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,15 @@
1
1
2
-
# Deploy infrastructure using GitHub Actions
2
+
# Deploy Infrastructure Using Azure DevOps
3
3
4
4
!!! info "Module Duration"
5
5
30 minutes
6
6
7
-
Azure Devops pipeline is another great way to automate your workflow. In this section, we will create a Azure Devops Pipeline to
8
-
deploy the infrastructure components of our application.
7
+
In the [previous section](../../aca/10-aca-iac-bicep/iac-bicep.md), we demonstrated how Bicep scripts can be used to automate the deployment of infrastructure components. However, creating the container registry and deploying the Bicep scripts using the Azure CLI still required manual effort. For a more efficient and streamlined process, it's preferable to use automation. Azure DevOps is a great solution for automating workflows, and in this section, we'll explain how to create a Azure DevOps pipeline for deploying the infrastructure components of our application.
9
8
10
-
The workshop repository contains a Azure Devops Pipeline yaml file that will be used to deploy the infrastructure
11
-
components of our application. Follow the steps below to create a devops pipeline to deploy the
12
-
infrastructure components of our application.
9
+
The workshop repository contains a Azure Devops Pipeline yaml file that will be used to deploy the infrastructure components of our application. Follow the steps below to create a devops pipeline to deploy the infrastructure components of our application.
10
+
11
+
!!! note
12
+
The following instructions assume that you will utilize the forked Github repository both as the host for your YAML pipeline and the source code. However, it is possible to host the same assets in your Azure DevOps repository instead, if that is your preference. It is important to remember that if you choose to store your assets in your Azure DevOps repository, you will have to direct your Azure DevOps pipeline towards the Azure DevOps repository instead of the Github repository.
13
13
14
14
### Fork the GitHub repository
15
15
@@ -20,14 +20,13 @@ Start by forking the workshop repository to your GitHub account. Follow the step
20
20
3. Select your GitHub account to fork the repository to.
21
21
4. Wait for the repository to be forked.
22
22
23
-
### Configure Service Connection for GitHub and Azure Subscription
23
+
### Configure a Service Connection for GitHub and Azure Subscription
24
24
25
25
Before we start with creating pipeline, we need to configure service connection for GitHub and Azure Subscription. You can do this in either existing or new project.
26
26
27
-
#### Create Service Connection for GitHub
27
+
#### Create a Service Connection for GitHub
28
28
29
-
Provide access to the repository forked above by creating a service connection to GitHub. You create a new pipeline
30
-
by first selecting a GitHub repository and then a YAML file in repository at path [.ado/infra-deploy.yml](https://raw.githubusercontent.com/Azure/aca-dotnet-workshop/main/.ado/infra-deploy.yml){target=_blank}.
29
+
Provide access to the repository forked above by creating a service connection to GitHub. You create a new pipeline by first selecting a GitHub repository and then a YAML file in repository at path [.ado/infra-deploy.yml](https://raw.githubusercontent.com/Azure/aca-dotnet-workshop/main/.ado/infra-deploy.yml){target=_blank}.
31
30
32
31
The repository in which the YAML file is present is called self repository. By default, this is the repository that your pipeline builds.
33
32
@@ -40,16 +39,28 @@ to create service connection for GitHub.
40
39
41
40
#### Create Service Connection for Azure Subscription
42
41
43
-
Create new service connection to your azure subscription by following steps at [this link](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops&tabs=yaml#create-a-service-connection){target=_blank}
42
+
Create a new service connection to your azure subscription by following the steps at [this link](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops&tabs=yaml#create-a-service-connection){target=_blank}.
44
43
45
44
!!! note
46
-
Update the created service connection role to have **[User Access Administrator](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#user-access-administrator)** role.
47
-
This is required for pipeline to be able to perform role assignments in the infrastructure components deployed.
45
+
Update the created service connection role to have **[User Access Administrator](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#user-access-administrator)** role. This is required for pipeline to be able to perform role assignments in the infrastructure components deployed. To update the role of a service connection in Azure DevOps to have the User Access Administrator role, you can follow these steps:
46
+
47
+
- Navigate to the Azure portal and select the subscription where the service connection is created.
48
+
49
+
- Click on **Access control (IAM)** in the left-hand menu.
50
+
51
+
- Click on **Add role assignment**.
48
52
49
-
### Configure Variable group under Library
53
+
- For the **Assignment type** choose **Privileged administrator roles**.
50
54
51
-
Create a variable group named **AcaApp** under Library in your Azure Devops project. Make sure the pipeline has
52
-
permissions to access the created variable group under **Pipeline permissions**.
55
+
- In the **Role** section choose **User Access Administrator**.
56
+
57
+
- In the **Members** section, search for the name of the service connection that you want to update and select it.
58
+
59
+
- Click **Save** to apply the changes.
60
+
61
+
### Configure Variable Group under Azure DevOps Library Section
62
+
63
+
Create a variable group named **AcaApp** under Library in your Azure Devops project. Make sure the pipeline has permissions to access the created variable group under **Pipeline permissions**.
53
64
54
65
This variable group will be used to store below details:
Repository variables `CONTAINER_REGISTRY_NAME` is only needed by pipeline, if you wish the images to be deployed from private ACR.
73
-
74
-
You may chose to skip defining this variable and the pipeline will use the [public github container registry images](https://github.com/orgs/Azure/packages?repo_name=aca-dotnet-workshop) to deploy the images.
83
+
Repository variable `CONTAINER_REGISTRY_NAME` is only needed by pipeline if you intend to deploy images from a private Azure Container Registry (ACR). You may chose to skip defining this variable and the pipeline will use the [public github container registry images](https://github.com/orgs/Azure/packages?repo_name=aca-dotnet-workshop) to deploy the images.
Copy file name to clipboardExpand all lines: docs/aca/10-aca-iac-bicep/ci-cd-git-action.md
+7-13Lines changed: 7 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,12 @@
1
1
2
-
# Deploy infrastructure using GitHub Actions
2
+
# Deploy Infrastructure Using GitHub Actions
3
3
4
4
!!! info "Module Duration"
5
5
30 minutes
6
6
7
-
GitHub Actions is a great way to automate your workflow. In this section, we will create a GitHub Action workflow to
8
-
deploy the infrastructure components of our application.
7
+
In the [previous section](../../aca/10-aca-iac-bicep/iac-bicep.md), we demonstrated how Bicep scripts can be used to automate the deployment of infrastructure components. However, creating the container registry and deploying the Bicep scripts using the Azure CLI still required manual effort. For a more efficient and streamlined process, it's preferable to use automation. GitHub Actions is a great solution for automating workflows, and in this section, we'll explain how to create a GitHub Action workflow for deploying the infrastructure components of our application.
9
8
10
-
The workshop repository contains a GitHub Action workflow file that will be used to deploy the infrastructure
11
-
components of our application. Follow the steps below to create a GitHub Action workflow to deploy the
12
-
infrastructure components of our application.
9
+
The workshop repository contains a GitHub Action workflow file that will be used to deploy the infrastructure components of our application. Follow the steps below to create a GitHub Action workflow to deploy the infrastructure components of our application.
13
10
14
11
### Fork the GitHub repository
15
12
@@ -109,8 +106,7 @@ locally, follow the steps below to configure the repository for OIDC authenticat
109
106
110
107
### Configure GitHub Repository Secrets
111
108
112
-
Configure secrets details in GitHub repo as described here in [create GitHub secrets](https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-cli%2Clinux#create-github-secrets).
113
-
Use below values mapped to relevant secrets in GitHub.
109
+
Configure secrets details in GitHub repo as described here in [create GitHub secrets](https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-cli%2Clinux#create-github-secrets). Use below values mapped to relevant secrets in GitHub.
114
110
115
111
```bash
116
112
# AZURE_SUBSCRIPTION_ID
@@ -123,11 +119,11 @@ echo $APP_ID
123
119
124
120
### Configure GitHub Repository Variables
125
121
126
-
Configure repository variables as shown below:
122
+
Configure repository variables in GitHub repo as described here in [create GitHub variables](https://docs.github.com/en/actions/learn-github-actions/variables). Use below values mapped to relevant variables in GitHub.
127
123
128
124
```bash
129
125
# LOCATION: Azure region where resources will be deployed
130
-
LOCATION=<location>
126
+
LOCATION=<location. e.g. eastus>
131
127
132
128
# RESOURCE_GROUP: Name of the resource group which will be created and resources will be deployed
With these steps completed, you are now ready to trigger the GitHub Actions workflow name **Build and deploy
148
-
infrastructure as code to Azure** using **workflow dispatch** to deploy the infrastructure components of our
149
-
application.
143
+
With these steps completed, you are now ready to trigger the GitHub Actions workflow named **Build and deploy infrastructure as code to Azure** using **workflow dispatch** to deploy the infrastructure components of the application.
If you're not interested in manually deploying the Bicep files or creating the container registry yourself, and prefer not to delve into the details of how they work, then you can skip this section and head directly to either [Build the Infrastructure as Code Using Bicep and Github](../../aca/10-aca-iac-bicep/ci-cd-git-action.md) or [Build the Infrastructure as Code Using Bicep and Azure DevOps](../../aca/10-aca-iac-bicep/ci-cd-azdo.md) depending on your DevOps tool of choice.
12
+
10
13
To begin, we need to define the Bicep modules that will be required to generate the Infrastructure code. Our goal for this module is to have a freshly created resource group that encompasses all the necessary resources and configurations - such as connection strings, secrets, environment variables, and Dapr components - which we utilized to construct our solution. By the end, we will have a new resource group that includes the following resources.
Throughout the various modules, we have utilized various Azure CLI commands to provision different resources. While this approach is suitable for this workshop, in a production environment, you will likely require a more automated process to deploy the same resources. In this module, we will be working on defining the proper process to automate the infrastructure provisioning by creating the scripts/templates to provision the resources. This process is known as IaC (Infrastructure as Code).
0 commit comments