Created
March 23, 2020 21:40
-
-
Save fabianwilliams-zz/68485bfbf0a328f4bce899cf4ed07065 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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