A simple demo on how to use PowerShell with Azure Functions
- az login
- az group create -n PowerShell_AZ_RG -l southcentralus
- az storage account create --name bjdpssa001 --location southcentralus --resource-group PowerShell_AZ_RG --sku Standard_LRS
- az functionapp create --name bjdps001 --storage-account bjdpssa001 --consumption-plan-location southcentralus --resource-group PowerShell_AZ_RG
- az functionapp identity assign --name bjdps001 --resource-group PowerShell_AZ_RG
- $functionAppId=(az functionapp identity show --name bjdps001 --resource-group PowerShell_AZ_RG --query 'principalId' --output tsv)
- az storage account create --name bjdlake002 --location southcentralus --resource-group PowerShell_AZ_RG --sku Standard_LRS
- $key=(az storage account keys list -n bjdlake002 --query "[0].value" -o tsv)
- az storage container create --name data --account-key $key --account-name bjdlake002
- az role assignment create --assignee-object-id $functionAppId --role "Storage Blob Data Contributor" -g PowerShell_AZ_RG
- az role assignment create --assignee-object-id $functionAppId --role "Reader" -g PowerShell_AZ_RG
- cd src
- func azure functionapp publish bjdps001