# Build the function app using dotnet publish $AzureFunctionAppPath ="" #Path of azure function $AzureFunctionAppZipPath="" #Path where zip file will be created $resourceGroupName = "" #Resource group name of azure function $functionAppName = "" #Name of azure function created in azure portal dotnet publish $AzureFunctionAppPath -c Release -o "$AzureFunctionAppPath\bin\Release" # Include the published output folder in the zip Compress-Archive -Path "$AzureFunctionAppPath\bin\Release\*" -DestinationPath "$AzureFunctionAppZipPath\functionApp.zip" -CompressionLevel Optimal Connect-AzAccount Publish-AzWebApp -ResourceGroupName $resourceGroupName -Name $functionAppName -ArchivePath "$AzureFunctionAppZipPath\functionApp.zip" Update-AzFunctionAppSetting -Name $functionAppName -ResourceGroupName $resourceGroupName -AppSetting @{"AzureAd:Audience" = ""} #Application ID URI created during `Expose an API' step Update-AzFunctionAppSetting -Name $functionAppName -ResourceGroupName $resourceGroupName -AppSetting @{"AzureAd:ClientId" = ""} Update-AzFunctionAppSetting -Name $functionAppName -ResourceGroupName $resourceGroupName -AppSetting @{"AzureAd:ClientSecret" = ""} Update-AzFunctionAppSetting -Name $functionAppName -ResourceGroupName $resourceGroupName -AppSetting @{"AzureAd:Instance" = "https://login.microsoftonline.com/"} Update-AzFunctionAppSetting -Name $functionAppName -ResourceGroupName $resourceGroupName -AppSetting @{"AzureAd:TenantId" = ""} Update-AzFunctionAppSetting -Name $functionAppName -ResourceGroupName $resourceGroupName -AppSetting @{"RunAsApplicationPermission" = ""} #True will use application permissions and false will use delegated permissions