Skip to content

Commit ab1a171

Browse files
committed
Merge branch 'master' of https://github.com/MicrosoftDocs/azure-docs-pr into cdnpatch
2 parents 825146f + c3fb59b commit ab1a171

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

articles/azure-resource-manager/templates/deploy-powershell.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,55 @@
22
title: Deploy resources with PowerShell and template
33
description: Use Azure Resource Manager and Azure PowerShell to deploy resources to Azure. The resources are defined in a Resource Manager template.
44
ms.topic: conceptual
5-
ms.date: 08/21/2019
5+
ms.date: 03/16/2020
66
---
77
# Deploy resources with Resource Manager templates and Azure PowerShell
88

99
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).
1010

1111
## Deployment scope
1212

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.
1416

1517
To deploy to a **resource group**, use [New-AzResourceGroupDeployment](/powershell/module/az.resources/new-azresourcegroupdeployment):
1618

1719
```azurepowershell
1820
New-AzResourceGroupDeployment -ResourceGroupName <resource-group-name> -TemplateFile <path-to-template>
1921
```
2022

21-
To deploy to a **subscription**, use [New-AzDeployment](/powershell/module/az.resources/new-azdeployment):
23+
To deploy to a **subscription**, use New-AzSubscriptionDeployment:
2224

2325
```azurepowershell
24-
New-AzDeployment -Location <location> -TemplateFile <path-to-template>
26+
New-AzSubscriptionDeployment -Location <location> -TemplateFile <path-to-template>
2527
```
2628

2729
For more information about subscription level deployments, see [Create resource groups and resources at the subscription level](deploy-to-subscription.md).
2830

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).
3046

3147
The examples in this article use resource group deployments.
3248

3349
## Prerequisites
3450

3551
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**.
3652

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:
3854

3955
- **Install Azure PowerShell cmdlets on your local computer.** For more information, see [Get started with Azure PowerShell](/powershell/azure/get-started-azureps).
4056
- **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 `
7187

7288
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).
7389

74-
## Deploy from Azure Cloud shell
90+
## Deploy from Azure Cloud Shell
7591

7692
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.
7793

0 commit comments

Comments
 (0)