• In this module Azure PowerShell, Azure CLI andARM_template have been mentioned.

1.) Powershell

  • Q. Why do we need to set the execution policy when installing Powershell?
  • Connect-AzAccount command to login to Powershell.

2.) Azure PowerShell

3.) Azure PowerShell with GitHub

<#
Command Reference
1. Set-AzResource
https://docs.microsoft.com/en-us/powershell/module/az.resources/set-azresource?view=azps-7.3.0
#>
# We are deploying an application from GitHub onto an existing Web App
# Ensure to use your own GitHub repository URL
 
 
Connect-AzAccount
$ResourceGroupName="powershell-grp"
$WebAppName="companyapp10000"
$Properties =@{
    repoUrl="";
    branch="master";
    isManualIntegration="true";
}
 
Set-AzResource -ResourceGroupName $ResourceGroupName `
-Properties $Properties -ResourceType Microsoft.Web/sites/sourcecontrols `
-ResourceName $WebAppName/web -ApiVersion 2015-08-01 -Force

Above script creates application like this,

4.) Azure PowerShelldeployment_slot

$ResourceGroupName="powershell-grp"
$WebAppName="companyapp10000"
$AppServicePlanName="companyplan"
  
# For deployment slots, the App Service Plan needs to be standard or higher
Connect-AzAccount
Set-AzAppServicePlan -Name $AppServicePlanName -ResourceGroupName $ResourceGroupName `
-Tier Standard
  
# We then create a Web App slot
$SlotName="Staging"
New-AzWebAppSlot -Name $WebAppName -ResourceGroupName $ResourceGroupName `
-Slot $SlotName
 
# We then deploy an application onto the Staging slot
# Ensure to use your own GitHub URL
 
$Properties =@{
    repoUrl="";
    branch="master";
    isManualIntegration="true";
}
 
Set-AzResource -ResourceGroupName $ResourceGroupName `
-Properties $Properties -ResourceType Microsoft.Web/sites/slots/sourcecontrols `
-ResourceName $WebAppName/$SlotName/web -ApiVersion 2015-08-01 -Force
 
# The following can be used to switch slots
$TargetSlot="production"
Switch-AzWebAppSlot -Name $WebAppName -ResourceGroupName $ResourceGroupName `
-SourceSlotName $SlotName -DestinationSlotName $TargetSlot

After running above script Azure Web App got deployed in staging env,

5.) Azure CLI

6.) Lab. Azure CLI - Azure Web App - Docker

7.)Azure_Lab Azure CLI - Azure Kubernetes Service

8.)ARM_template

  • Allows infrastructure as code for Azure.

9.)Azure_Lab ARM_template Azure Storage Accounts - Building and deploying template

10.)Azure_Lab Multiple copies of a resource

Labs List

Questions