Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@crowcoder
Created April 13, 2020 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crowcoder/d2fd41c90856e5fe2f19d507bf1d929f to your computer and use it in GitHub Desktop.
Save crowcoder/d2fd41c90856e5fe2f19d507bf1d929f to your computer and use it in GitHub Desktop.
#####################
## EXERCISE 2
#####################
# Authenticate to Azure
Connect-AzAccount
# List the subscriptions your account has access to
Get-AzSubscription
# You may have multiple subscriptions. If the one you want to use for this tutorial
# is not your default subscription, you can do this to change what subscription
# this script will operate against.
# Set-AzContext -SubscriptionId "<enter your subscription id>"
# Create resource group to hold all resources for the tutorial.
# Change the region as appropriate for your location
$groupName = "rg-igas-01"
$location = "eastus"
New-AzResourceGroup -Name $groupName -Location $location
# Create an app service plan
$plan = New-AzAppServicePlan -Location $location -Name "asp-igas-01" -ResourceGroupName $groupName -Tier "S1"
# Create the App Service to host the application
# The name has to be unique across all of Azure because it is part of the public URL.
# Set the prefix variable to something unique, either completely random or meaningful, doesn't matter.
$prefix = "???"
$app = New-AzWebApp -ResourceGroupName $groupName -Name "$prefix-igas-01" -Location $location -AppServicePlan $plan.Id
# Browse to the URL of the new application to make sure the app service is up.
$newurl = "https://$prefix-igas-01.azurewebsites.net"
[System.Diagnostics.Process]::Start($newurl)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment