Loading, please wait...



How to create and deploy ARM Template using Azure CLI and Azure PowerShell

In this article, we will learn step-by-step how to create and deploy Azure Resource Manager Template using Azure CLI and Azure PowerShell

In this article, we will learn step-by-step how to create and deploy Azure Resource Manager Template using Azure CLI and Azure PowerShell
Note: I have already created a resource group "az-monday-rg", if you do not have, create it first.

Azure CLI

Step1: Login to Azure Account
C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.9>az login

Output:
Note, we have launched a browser for you to login. For old experience with device code, use "az login --use-device-code"
You have logged in. Now let us find all the subscriptions to which you have access...

[
{
"cloudName":"AzureCloud",
"id":"7******0-2**a-4*da-bf0a-f******6",
"isDefault":true,
"name":"Free Trial",
"state":"Enabled",
"tenantId":"2b77ae1a-2d32-4807-8cde-dbb56ac43a64",
"user":{
"name":"virendra.gour4726@gmail.com",
"type":"user"
}
}
]

Step2: Deploy template.json file which we have edited in recent article "Azure Resource Manager Template- Part2"
C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.9>az group deployment create --name template --resource-group az-monday-rg --template-file "E:\Azure Stuff\Articals\ARM\template\template.json"

Output

(Provide inputs like location, accountType, kind, accessTier and supportsHttpsTrafficOnly)
Please provide string value for 'location' (? for help): centralus
Please provide string value for 'accountType' (? for help): Standard_LRS
Please provide string value for 'kind' (? for help): StorageV2
Please provide string value for 'accessTier' (? for help): Hot
Please provide bool value for 'supportsHttpsTrafficOnly' (? for help): (t/f): t
{
"id":"/subscriptions/7******0-2**a-4*da-bf0a-f******6/resourceGroups/az-monday-rg/providers/Microsoft.Resources/deployments/template",
"location":null,
"name":"template",
"properties":{
"correlationId":"0a048b50-5b2a-4214-8698-61d80bf8a955",
"debugSetting":null,
"dependencies":[

],
"duration":"PT49.1813927S",
"mode":"Incremental",
"onErrorDeployment":null,
"outputResources":[
{
"id":"/subscriptions/7******0-2**a-4*da-bf0a-f******6/resourceGroups/az-monday-rg/providers/Microsoft.Storage/storageAccounts/yepzgbdy6vys2storage",
"resourceGroup":"az-monday-rg"
}
],
"outputs":{

},
"parameters":{
"accessTier":{
"type":"String",
"value":"Hot"
},
"accountType":{
"type":"String",
"value":"Standard_LRS"
},
"kind":{
"type":"String",
"value":"StorageV2"
},
"location":{
"type":"String",
"value":"centralus"
},
"supportsHttpsTrafficOnly":{
"type":"Bool",
"value":true
}
},
"parametersLink":null,
"providers":[
{
"id":null,
"namespace":"Microsoft.Storage",
"registrationPolicy":null,
"registrationState":null,
"resourceTypes":[
{
"aliases":null,
"apiVersions":null,
"capabilities":null,
"locations":[
"centralus"
],
"properties":null,
"resourceType":"storageAccounts"
}
]
}
],
"provisioningState":"Succeeded",
"template":null,
"templateHash":"14194993164762120570",
"templateLink":null,
"timestamp":"2019-10-14T16:26:21.813256+00:00"
},
"resourceGroup":"az-monday-rg",
"type":"Microsoft.Resources/deployments"
}


===============================================================================================

Azure PowerShell

Step1: Login to Azure Account

PS C:\Users\Viren2302\Desktop\PowerShell-6.2.3-win-x64> Connect-AzAccount

Output:
WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code HVH776S2H to authenticate.

Account                                SubscriptionName               TenantId                                                    Environment
-------                                   ----------------                    --------                                                      -----------
virendra.****@gmail.com      Free Trial                            2b77ae1a-2d32-4807-8cde-dbdhsdhfiirh64  AzureCloud

Step2: Deploy template.json file which we have edited in recent article "Azure Resource Manager Template- Part2"
PS C:\Users\Viren2302\Desktop\PowerShell-6.2.3-win-x64> New-AzResourceGroupDeployment -Name template -ResourceGroupName az-monday-rg -TemplateFile "E:\Azure Stuff\Articals\ARM\template\template.json"

Output(Provide inputs like location, accountType, kind, accessTier and supportsHttpsTrafficOnly)
cmdlet New-AzResourceGroupDeployment at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
location: central US
accountType: Standard_LRS
kind: StorageV2
accessTier: Hot
supportsHttpsTrafficOnly: true

DeploymentName                   : template
ResourceGroupName               : az-monday-rg
ProvisioningState                    : Succeeded
Timestamp                             : 10/14/2019 4:36:15 PM
Mode                                     : Incremental
TemplateLink :
Parameters :
  Name                                                     Type                                                     Value
  ==========                 ========================== ========================= 
  Standard_LRS                                       location                                                  String                                                   
  central US                                            accountType                                            String                                                   
  StorageV2                                            kind                                                        String                                                   
  Hot                                                      accessTier                                               String                                                   
  True                                                     supportsHttpsTrafficOnly                           Bool                                                    

Outputs :
DeploymentDebugLogLevel :

 

Check the Azure Storage Account to login Azure Portal

 

Thank You.