Skip to content

Instantly share code, notes, and snippets.

@fabianwilliams-zz
Created March 23, 2020 21:40
Show Gist options
  • Save fabianwilliams-zz/68485bfbf0a328f4bce899cf4ed07065 to your computer and use it in GitHub Desktop.
Save fabianwilliams-zz/68485bfbf0a328f4bce899cf4ed07065 to your computer and use it in GitHub Desktop.
# Login to Azure
az login
# This will also give you a list of your current subscriptions
# To get an organized list of subscriptions in a tabular format
az account list --output table
# If you are not set to the default Subscription you want to use. Issue this command
# Use az account set with the subscription ID or name you want to switch to
az account set --subscription "The Name of the Subcription Here"
#Create Azure Resource Group
$resourceGroup = "AzureFunctionsFoodie"
$location = "eastus2"
az group create -n $resourceGroup -l $location
# Create a Storage Account for the Azure Function
$rand = Get-Random -Minimum 10000 -Maximum 99999
$storageAccountName = "affoodie$rand"
az storage account create `
-n $storageAccountName `
-l $location `
-g $resourceGroup `
--sku Standard_LRS
# Create an Application Insights instance
$appInsightsName = "affoodieappinsight$rand"
az resource create `
-g $resourceGroup -n $appInsightsName `
--resource-type "Microsoft.Insights/components" `
--properties '{\"Application_Type\":\"web\"}'
# Create the Function App
$functionAppName = "foodie-alpha-$rand"
az functionapp create `
-n $functionAppName `
--storage-account $storageAccountName `
--consumption-plan-location $location `
--app-insights $appInsightsName `
--runtime dotnet `
-g $resourceGroup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment