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
@@ -4,94 +4,177 @@ description: Configure continuous deployment to your applications hosted in Azur
4
4
ms.service: azure-government
5
5
ms.topic: article
6
6
ms.custom: devx-track-azurepowershell
7
-
ms.date: 03/02/2022
7
+
recommendations: false
8
+
ms.date: 06/27/2022
8
9
---
9
10
10
11
# Deploy an app in Azure Government with Azure Pipelines
11
12
12
-
This article helps you use Azure Pipelines to set up continuous integration (CI) and continuous deployment (CD) of your web app running in Azure Government. CI/CD automates the build of your code from a repo along with the deployment (release) of the built code artifacts to a service or set of services in Azure Government. In this tutorial, you'll build a web app and deploy it to an Azure Governments app service. This build and release process is triggered by a change to a code file in the repo.
13
+
This how-to guide helps you use Azure Pipelines to set up continuous integration (CI) and continuous delivery (CD) of your web app running in Azure Government. CI/CD automates the build of your code from a repository along with the deployment (release) of the built code artifacts to a service or set of services in Azure Government. In this how-to guide, you'll build a web app and deploy it to an Azure Governments App Service. The build and release process is triggered by a change to a code file in the repository.
13
14
14
-
[Azure Pipelines](/azure/devops/pipelines/get-started/what-is-azure-pipelines) is used by teams to configure continuous deployment for applications hosted in Azure subscriptions. We can use this service for applications running in Azure Government by defining [service connections](/azure/devops/pipelines/library/service-endpoints) for Azure Government.
15
+
> [!NOTE]
16
+
> [Azure DevOps](/azure/devops/) isn't available on Azure Government. While this how-to guide shows how to configure the CI/CD capabilities of Azure Pipelines to deploy an app to a service inside Azure Government, be aware that Azure Pipelines runs its pipelines outside of Azure Government. Research your organization's security and service policies before using it as part of your deployment tools. For guidance on how to use Azure DevOps Server to create a DevOps experience inside a private network on Azure Government, see [Azure DevOps Server on Azure Government](https://devblogs.microsoft.com/azuregov/azure-devops-server-in-azure-government/).
17
+
18
+
[Azure Pipelines](/azure/devops/pipelines/get-started/what-is-azure-pipelines) is used by development teams to configure continuous deployment for applications hosted in Azure subscriptions. We can use this service for applications running in Azure Government by defining [service connections](/azure/devops/pipelines/library/service-endpoints) for Azure Government.
Before starting this tutorial, you must complete the following prerequisites:
24
+
Before starting this how-to guide, you must complete the following prerequisites:
21
25
22
-
+[Create an organization in Azure DevOps](/azure/devops/organizations/accounts/create-organization)
23
-
+[Create and add a project to the Azure DevOps organization](/azure/devops/organizations/projects/create-project?;bc=%2fazure%2fdevops%2fuser-guide%2fbreadcrumb%2ftoc.json&tabs=new-nav&toc=%2fazure%2fdevops%2fuser-guide%2ftoc.json)
24
-
+ Install and set up [Azure PowerShell](/powershell/azure/install-az-ps)
26
+
-[Create an organization in Azure DevOps](/azure/devops/organizations/accounts/create-organization)
27
+
-[Create and add a project to the Azure DevOps organization](/azure/devops/organizations/projects/create-project)
28
+
- Install and set up [Azure PowerShell](/powershell/azure/install-az-ps)
25
29
26
30
If you don't have an active Azure Government subscription, create a [free account](https://azure.microsoft.com/global-infrastructure/government/request/) before you begin.
27
31
28
-
## Create Azure Government app service
29
-
30
-
[Create an App service in your Azure Government subscription](documentation-government-howto-deploy-webandmobile.md).
31
-
The following steps will set up a CD process to deploy to this Web App.
32
-
33
-
## Set up Build and Source control integration
34
-
35
-
Follow through one of the quickstarts below to set up a Build for your specific type of app:
-[Node.js app with Gulp](/azure/devops/pipelines/ecosystems/javascript)
40
-
41
-
## Generate a service principal
42
-
43
-
1. Download or copy and paste the [service principal creation](https://github.com/yujhongmicrosoft/spncreationn/blob/master/spncreation.ps1) PowerShell script into an IDE or editor.
44
-
45
-
> [!NOTE]
46
-
> This script will be updated to use the Azure Az PowerShell module instead of the deprecated AzureRM PowerShell module.
47
-
48
-
2. Open up the file and navigate to the `param` parameter. Replace the `$environmentName` variable with
49
-
AzureUSGovernment." This action sets the service principal to be created in Azure Government.
50
-
51
-
3. Open your PowerShell window and run the following command. This command sets a policy that enables running local files.
32
+
## Create Azure Government App Service app
33
+
34
+
Follow [Tutorial: Deploy an Azure App Service app](./documentation-government-howto-deploy-webandmobile.md) to learn how to deploy an Azure App Service app to Azure Government. The following steps will set up a CD process to deploy to your web app.
35
+
36
+
## Set up build and source control integration
37
+
38
+
Review one of the following quickstarts to set up a build for your specific type of app:
1. Copy and paste the following service principal creation PowerShell script into an IDE or editor, and then save the script. This code is compatible only with Azure Az PowerShell v7.0.0 or higher.
47
+
48
+
```powershell
49
+
param
50
+
(
51
+
[Parameter(Mandatory=$true, HelpMessage="Enter Azure subscription name - you need to be subscription admin to execute the script")]
52
+
[string] $subscriptionName,
53
+
54
+
[Parameter(Mandatory=$false, HelpMessage="Provide SPN role assignment")]
55
+
[string] $spnRole = "owner",
56
+
57
+
[Parameter(Mandatory=$false, HelpMessage="Provide Azure environment name for your subscription")]
$isAzureModulePresent = Get-Module -Name Az -ListAvailable
72
+
if ([String]::IsNullOrEmpty($isAzureModulePresent) -eq $true)
73
+
{
74
+
Write-Output "Script requires Azure PowerShell modules to be present. Obtain Azure PowerShell from https://docs.microsoft.com//powershell/azure/install-az-ps" -Verbose
75
+
return
76
+
}
77
+
78
+
Import-Module -Name Az.Accounts
79
+
Write-Output "Provide your credentials to access your Azure subscription $subscriptionName" -Verbose
2. Open your PowerShell window and run the following command, which sets a policy that enables running local files:
52
124
53
125
`Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass`
54
126
55
-
When you're asked whether you want to change the execution policy, enter "A" (for "Yes to All").
127
+
When asked whether you want to change the execution policy, enter "A" (for "Yes to All").
56
128
57
-
4. Navigate to the directory that has the edited script above.
129
+
3. Navigate to the directory where you saved the service principal creation PowerShell script.
58
130
59
-
5. Edit the following command with the name of your script and run:
131
+
4. Edit the following command with the name of your script and run:
60
132
61
133
`./<name of script file you saved>`
62
134
63
-
6. The "subscriptionName" parameter can be found by logging into your Azure Government subscription via `Connect-AzAccount -EnvironmentName AzureUSGovernment` and then running `Get-AzureSubscription`.
64
-
65
-
7. When prompted for the "password" parameter, enter your desired password.
135
+
5. The "subscriptionName" parameter can be found by logging into your Azure Government subscription via `Connect-AzAccount -EnvironmentName AzureUSGovernment` and then running `Get-AzureSubscription`.
66
136
67
-
8. After providing your Azure Government subscription credentials, you should see the following message:
137
+
6. After providing your Azure Government subscription credentials, you should see the following message:
68
138
69
-
> [!NOTE]
70
-
> The Environment variable should be `AzureUSGovernment`.
139
+
`The Environment variable should be AzureUSGovernment`
71
140
72
-
9. After the script has run, you should see your service connection values. Copy these values as we'll need them when setting up our endpoint.
141
+
7. After the script has run, you should see your service connection values. Copy these values as we'll need them when setting up our endpoint.
:::image type="content" source="./media/documentation-government-vsts-img11.png" alt-text="Service connection values displayed after running the PowerShell script." border="false":::
75
144
76
145
## Configure the Azure Pipelines service connection
77
146
78
-
Follow the instructions in [Service connections for builds and releases](/azure/devops/pipelines/library/service-endpoints) to set up the Azure Pipelines service connection.
147
+
Follow [Manage service connections](/azure/devops/pipelines/library/service-endpoints) to set up the Azure Pipelines service connection.
148
+
149
+
Make one change specific to Azure Government:
79
150
80
-
Make one change specific to Azure Government: In step #3 of [Service connections for builds and releases](/azure/devops/pipelines/library/service-endpoints), click on "use the full version of the service connection catalog" and set **Environment** to **AzureUSGovernment**.
151
+
- In step #3 of [Manage service connections: Create a service connection](/azure/devops/pipelines/library/service-endpoints#create-a-service-connection), click on *Use the full version of the service connection catalog* and set **Environment** to **AzureUSGovernment**.
81
152
82
153
## Define a release process
83
154
84
-
Follow [Deploy a web app to Azure App Services](/azure/devops/pipelines/apps/cd/deploy-webdeploy-webapps) instructions to set up your release pipeline and deploy to your application in Azure Government.
155
+
Follow [Deploy an Azure Web App](/azure/devops/pipelines/targets/webapp) instructions to set up your release pipeline and deploy to your application in Azure Government.
85
156
86
157
## Q&A
87
158
88
159
**Do I need a build agent?** <br/>
89
-
You need at least one [agent](/azure/devops/pipelines/agents/agents) to run your deployments. By default, the build and deployment processes are configured to use the [hosted agents](/azure/devops/pipelines/agents/agents#microsoft-hosted-agents). Configuring a private agent would limit data sharing outside of Azure Government.
160
+
You need at least one [agent](/azure/devops/pipelines/agents/agents) to run your deployments. By default, the build and deployment processes are configured to use [hosted agents](/azure/devops/pipelines/agents/agents#microsoft-hosted-agents). Configuring a private agent would limit data sharing outside of Azure Government.
90
161
91
-
**I use Team Foundation Server on premises. Can I configure CD on my server to target Azure Government?** <br/>
92
-
Currently, Team Foundation Server can't be used to deploy to an Azure Government Cloud.
162
+
**Can I configure CD on Azure DevOps Server (formerly Team Foundation Server) to target Azure Government?** <br/>
163
+
You can set up Azure DevOps Server in Azure Government. For guidance on how to use Azure DevOps Server to create a DevOps experience inside a private network on Azure Government, see [Azure DevOps Server on Azure Government](https://devblogs.microsoft.com/azuregov/azure-devops-server-in-azure-government/).
93
164
94
165
## Next steps
95
166
96
-
- Subscribe to the [Azure Government blog](https://devblogs.microsoft.com/azuregov/)
97
-
- Get help on Stack Overflow by using the "[azure-gov](https://stackoverflow.com/questions/tagged/azure-gov)" tag
167
+
For more information, see the following resources:
168
+
169
+
- [Sign up for Azure Government trial](https://azure.microsoft.com/global-infrastructure/government/request/?ReqType=Trial)
170
+
- [Acquiring and accessing Azure Government](https://azure.microsoft.com/offers/azure-government/)
171
+
- [Ask questions via the azure-gov tag on StackOverflow](https://stackoverflow.com/tags/azure-gov)
172
+
- [Azure Government blog](https://devblogs.microsoft.com/azuregov/)
173
+
- [What is Infrastructure as Code? – Azure DevOps](/devops/deliver/what-is-infrastructure-as-code)
174
+
- [DevSecOps for infrastructure as code (IaC) – Azure Architecture Center](/azure/architecture/solution-ideas/articles/devsecops-infrastructure-as-code)
175
+
- [Testing your application and Azure environment – Microsoft Azure Well-Architected Framework](/azure/architecture/framework/devops/release-engineering-testing)
176
+
- [Azure Government overview](./documentation-government-welcome.md)
177
+
- [Azure Government security](./documentation-government-plan-security.md)
178
+
- [Compare Azure Government and global Azure](./compare-azure-government-global-azure.md)
179
+
- [Azure Government compliance](./documentation-government-plan-compliance.md)
0 commit comments