Skip to Content
Hands-On Cloud Solutions with Azure
book

Hands-On Cloud Solutions with Azure

by Greg Leonardo
October 2018
Intermediate to advanced
224 pages
5h 22m
English
Packt Publishing
Content preview from Hands-On Cloud Solutions with Azure

Deploy-AzureResourceGroup.ps1

In this PowerShell script, we are going to check to see if you are logged in. If you are not logged in, the script will run a validation on your script, create a storage area, upload files to the storage, assign a 4-hour access key, and then run the deployment. The majority of PowerShell is generated when you select an Azure Resource Manager in Visual Studio, but I did add the following login function to help ensure that I am logged in to the right tenant:

function Check-Login{    $needLogin = $true    Try     {        $content = Get-AzureRmContext        if ($content)         {            $needLogin = ([string]::IsNullOrEmpty($content.Account))        }     }     Catch     {        if ($_ -like "*Login-AzureRmAccount to login*")         {            $needLogin = $true        }         else         {            throw        }
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Implementing Azure DevOps Solutions

Implementing Azure DevOps Solutions

Henry Been, Maik van der Gaag
Cloud Native Infrastructure with Azure

Cloud Native Infrastructure with Azure

Nishant Singh, Michael Kehoe
DevOps with Azure

DevOps with Azure

Allen ONeill

Publisher Resources

ISBN: 9781786468659Supplemental Content