|
2 | 2 | title: Deploy resources with PowerShell and template
|
3 | 3 | description: Use Azure Resource Manager and Azure PowerShell to deploy resources to Azure. The resources are defined in a Resource Manager template.
|
4 | 4 | ms.topic: conceptual
|
5 |
| -ms.date: 08/21/2019 |
| 5 | +ms.date: 03/16/2020 |
6 | 6 | ---
|
7 | 7 | # Deploy resources with Resource Manager templates and Azure PowerShell
|
8 | 8 |
|
9 | 9 | Learn how to use Azure PowerShell with Resource Manager templates to deploy your resources to Azure. For more information about the concepts of deploying and managing your Azure solutions, see [template deployment overview](overview.md).
|
10 | 10 |
|
11 | 11 | ## Deployment scope
|
12 | 12 |
|
13 |
| -You can target your deployment to either an Azure subscription or a resource group within a subscription. In most cases, you'll target deployment to a resource group. Use subscription deployments to apply policies and role assignments across the subscription. You also use subscription deployments to create a resource group and deploy resources to it. Depending on the scope of the deployment, you use different commands. |
| 13 | +You can target your deployment to a resource group, subscription, management group, or tenant. In most cases, you'll target deployment to a resource group. To apply policies and role assignments across a larger scope, use subscription, management group, or tenant deployments. When deploying to a subscription, you can create a resource group and deploy resources to it. |
| 14 | + |
| 15 | +Depending on the scope of the deployment, you use different commands. |
14 | 16 |
|
15 | 17 | To deploy to a **resource group**, use [New-AzResourceGroupDeployment](/powershell/module/az.resources/new-azresourcegroupdeployment):
|
16 | 18 |
|
17 | 19 | ```azurepowershell
|
18 | 20 | New-AzResourceGroupDeployment -ResourceGroupName <resource-group-name> -TemplateFile <path-to-template>
|
19 | 21 | ```
|
20 | 22 |
|
21 |
| -To deploy to a **subscription**, use [New-AzDeployment](/powershell/module/az.resources/new-azdeployment): |
| 23 | +To deploy to a **subscription**, use New-AzSubscriptionDeployment: |
22 | 24 |
|
23 | 25 | ```azurepowershell
|
24 |
| -New-AzDeployment -Location <location> -TemplateFile <path-to-template> |
| 26 | +New-AzSubscriptionDeployment -Location <location> -TemplateFile <path-to-template> |
25 | 27 | ```
|
26 | 28 |
|
27 | 29 | For more information about subscription level deployments, see [Create resource groups and resources at the subscription level](deploy-to-subscription.md).
|
28 | 30 |
|
29 |
| -Currently, management group deployments are only supported through the REST API. For more information about management group level deployments, see [Create resources at the management group level](deploy-to-management-group.md). |
| 31 | +To deploy to a **management group**, use [New-AzManagementGroupDeployment](/powershell/module/az.resources/New-AzManagementGroupDeployment). |
| 32 | + |
| 33 | +```azurepowershell |
| 34 | +New-AzManagementGroupDeployment -Location <location> -TemplateFile <path-to-template> |
| 35 | +``` |
| 36 | + |
| 37 | +For more information about management group level deployments, see [Create resources at the management group level](deploy-to-management-group.md). |
| 38 | + |
| 39 | +To deploy to a **tenant**, use [New-AzTenantDeployment](/powershell/module/az.resources/new-aztenantdeployment). |
| 40 | + |
| 41 | +```azurepowershell |
| 42 | +New-AzTenantDeployment -Location <location> -TemplateFile <path-to-template> |
| 43 | +``` |
| 44 | + |
| 45 | +For more information about tenant level deployments, see [Create resources at the tenant level](deploy-to-tenant.md). |
30 | 46 |
|
31 | 47 | The examples in this article use resource group deployments.
|
32 | 48 |
|
33 | 49 | ## Prerequisites
|
34 | 50 |
|
35 | 51 | You need a template to deploy. If you don't already have one, download and save an [example template](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-storage-account-create/azuredeploy.json) from the Azure Quickstart templates repo. The local file name used in this article is **c:\MyTemplates\azuredeploy.json**.
|
36 | 52 |
|
37 |
| -Unless you use the Azure Cloud shell to deploy templates, you need to install Azure PowerShell and connect to Azure: |
| 53 | +Unless you use the Azure Cloud Shell to deploy templates, you need to install Azure PowerShell and connect to Azure: |
38 | 54 |
|
39 | 55 | - **Install Azure PowerShell cmdlets on your local computer.** For more information, see [Get started with Azure PowerShell](/powershell/azure/get-started-azureps).
|
40 | 56 | - **Connect to Azure by using [Connect-AZAccount](/powershell/module/az.accounts/connect-azaccount)**. If you have multiple Azure subscriptions, you might also need to run [Set-AzContext](/powershell/module/Az.Accounts/Set-AzContext). For more information, see [Use multiple Azure subscriptions](/powershell/azure/manage-subscriptions-azureps).
|
@@ -71,7 +87,7 @@ New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName `
|
71 | 87 |
|
72 | 88 | The preceding example requires a publicly accessible URI for the template, which works for most scenarios because your template shouldn't include sensitive data. If you need to specify sensitive data (like an admin password), pass that value as a secure parameter. However, if you don't want your template to be publicly accessible, you can protect it by storing it in a private storage container. For information about deploying a template that requires a shared access signature (SAS) token, see [Deploy private template with SAS token](secure-template-with-sas-token.md). To go through a tutorial, see [Tutorial: Integrate Azure Key Vault in Resource Manager Template deployment](template-tutorial-use-key-vault.md).
|
73 | 89 |
|
74 |
| -## Deploy from Azure Cloud shell |
| 90 | +## Deploy from Azure Cloud Shell |
75 | 91 |
|
76 | 92 | You can use the [Azure Cloud Shell](https://shell.azure.com) to deploy your template. To deploy an external template, provide the URI of the template. To deploy a local template, you must first load your template into the storage account for your Cloud Shell. To upload files to the shell, select the **Upload/Download files** menu icon from the shell window.
|
77 | 93 |
|
|
0 commit comments