I'm not able to create the azure function in python which can be used to run python script on PowerApps.
I've tried it on command prompt and also on a visual studio in the app got created but I was not able to deploy it.
Is it possible to automate the execution of a Python script using Microsoft Flow?
I'm using this link to create the azure function
(.env) C:\Users\PAhire2\MyFunctionProj>az functionapp create --resource-group myResourceGroup --os-type Windows --consumption-plan-location westeurope --runtime python --name NewApp --storage-account 1234store
usage error: Currently supported runtimes (--runtime) in windows function apps are: dotnet, node, java, powershell.
This is the error message I'm getting
You get this error cause the python function only could be created on the Linux OS on Azure, so just change your os-type to Linux, it will be success.
az functionapp create --resource-group mygroup --os-type Linux --consumption-plan-location westeurope --runtime python --name pythonfunctiontest --storage-account mystorageaccount
I test with Azure Cloud Shell and it works. Hope this could help you. Also you could refer to the tutorial:Create a function app in Azure.
Related
I run following command
az vm create --resource-group MyRG --name myVMName --image windows-11:win11–21h2-pro:22000.376.2112072052
This causes following error.
API version 2022-03-01 does not have operation group 'virtual_machine_images'
I assume this means --image no more support but what's the alternative? Couldn't find anything relevant in the Auzre cli documentation about this. My az cli version seems upto date
az --version
azure-cli 2.37.0
core 2.37.0
telemetry 1.0.6
Extensions:
azure-devops 0.24.0
Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.0.0
Python location '/usr/bin/python3'
Extensions directory '/home/kali/.azure/cliextensions'
Extensions system directory '/usr/lib/python3/dist-packages/azure-cli-extensions'
Python (Linux) 3.10.5 (main, Jun 8 2022, 09:26:22) [GCC 11.3.0]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Update:
This error is not specific to windows-11, I am getting same error with other OS too. See image below for detailed error.
az vm create --resource-group MyRG --name myVMName --image
windows-11:win11–21h2-pro:22000.376.2112072052
The image version you are using in your cmdlet is not supported. I would suggest you use the below Azure Cli cmdlet to see the list of supported windows-11:win11-21h2-pro images to deploy a virtual machine.
az vm image list --all --offer windows-11 --sku win11-21h2-pro -o table
Below image shows when we ran the above cmdlet from Azure cloudshell:
Below image shows when we ran the above cmdlet from local AzureCLI:
Note: I have tested the above az vm image list cmdlet in local & Azure Cloudshell as well it is working fine,I am able to see the list of support images and their respective versions.
I have ran the below cmdlet, am able to deploy the virtual machine using the image (MicrosoftWindowsDesktop:windows-11:win11-21h2-pro:22000.675.220507).You just need to use the image version that is shown in the above list
az vm create --resource-group <resourcegroupName> --name <vmName> --image MicrosoftWindowsDesktop:windows-11:win11-21h2-pro:22000.675.220507
When I try to deploy an Azure Function to the cloud using... func azure functionapp publish appName --build remote --publish-local-settings
...I receive the following error
Getting site publishing info...
Remote build is a new feature added to function apps.
Your function app appName does not support remote build as it was created before August 1st, 2019.
Please use '--build local' or '--build-native-deps'.
For more information, please visit https://aka.ms/remotebuild
EVEN THOUGH THE APP WAS LITERALLY JUST CREATED IN AZURE PORTAL.
System:
- Running VS Code on Ubuntu 18.04
Steps to reproduce:
Create a new Function App (and support resources) using az cli
Python runtime
Consumption plan
StandardV2 Storage plan
AppInsights
Create new Function (scaffolding) using VS Code Azure Functions extension
Create __init__.py and configure local.settings.json
Open a terminal; cd to Function folder
Run func azure functionapp publish appName --build remote --publish-local-settings
Fails everytime with the message above
Tried so far:
- Substituting --build local.
- Looks like it wants to work, but fails with error
There was an error restoring dependencies. ERROR: cannot install cryptography-2.9.2 dependency: binary dependencies without wheels are not supported when building locally. Use the "--build remote" option to build dependencies on the Azure Functions build server, or "--build-native-deps" option to automatically build and configure the dependencies using a Docker container. More information at https://aka.ms/func-python-publish
Not going to try:
- --build-local-deps because I don't want a docker instance for my Function App
Please advise. This is painful at this point.
In my case, I was provisioning an azurerm_linux_function_app with terraform and got this error. The error turned out to be caused by me forgetting to specify the storage_account_access_key setting. The docs even mention
One of storage_account_access_key or storage_uses_managed_identity must be specified when using storage_account_name.
But terraform does not actually check that when applying your configuration, resulting in a cryptic error message much later in the process.
Here is what was found today:
I initially created the Function App Storage Account with...
# Create a Function App Storage Account
az storage account create \
--name $fa_storage_name \
--resource-group $rg_name \
--access-tier Cool \
--default-action Deny \
--kind StorageV2 \
--subscription $az_sub
--location $az_loc \
--sku Standard_LRS
Changed this to...
# Create a Function App Storage Account
az storage account create \
--name $fa_storage_name \
--resource-group $rg_name \
--location $az_loc \
--sku Standard_LRS
...and was able to get past that error. The way I stumbled onto this was using the --buld local flag. It gave me a MUCH MORE ACCURATE error. Something along the lines of Check your storage account dude.
(thank you Marcelo!)
I'm trying to create Web App which is just having a Static HTML. I'm following this link https://learn.microsoft.com/en-us/azure/app-service/app-service-web-get-started-html. But when I execute the following command
az webapp up --location westeurope --name .
Got the error - " Could not auto-detect the runtime stack of your app" .
I tried the following, but added the --html flag at the end of the az webapp up command to bypass auto detection:
mkdir quickstart
cd quickstart
git clone https://github.com/Azure-Samples/html-docs-hello-world.git
cd html-docs-hello-world
az webapp up --location westeurope --name azurewebapptest123 --html
That forces HTML. In the help for the command it implies auto-detection works for a bunch of language, but not for static HTML.
I just tried following the steps mentioned in the documentation. Works for me.
mkdir quickstart
cd quickstart
git clone https://github.com/Azure-Samples/html-docs-hello-world.git
cd html-docs-hello-world
az webapp up --location westeurope --name azurewebapptest123
I have tried the similar steps using the sample repo and was able to reproduce it.
Here is the version:
It's a known bug for Azure CLI 2.0.78 and team is working on it, Which you can track it here:
https://github.com/MicrosoftDocs/azure-docs/issues/43633
Work around of this issue is to use the older version of Azure CLi e.g. 2.0.75 * for deploying the solution.
Hope it helps.
Try to manually include a web.config file and/or select the stack on General Settings:
If you have no backend, the best option to host a static site is through Azure Storage:
https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website
I had the same problem. I solved it by using the flag --html to define explicitly the runtime according to the documentation of the runtime detection. https://github.com/Azure/app-service-linux-docs/blob/master/AzWebAppUP/runtime_detection.md
So, the solution is the following line of code:
az webapp up --location westeurope --name <name> --html
N.B: I used Azure cloud shell.
Make sure you're running the command "az webapp up --location westeurope --name" from your application root, ie inside 'html-docs-hello-world' folder.
at end of az webapp command you have give run time stack
if you are using an html page then --html you must give
Ex: az webapp up --location westeurope --name az204samplewebapphtml1 --html
To overcome this error you will need to:
cd {directory}
pip freeze > requirements.txt
The file does not need to have anything just needs to exist as azure looks for the files presence when running the deployment
I am trying to configure a Pipeline with Jenkins and deploying it to Azure. I am at the last step of a tutorial:
https://learn.microsoft.com/en-us/azure/jenkins/tutorial-jenkins-deploy-web-app-azure-app-service
This last step is as follows, i have to enter this in the Azure CLI:
az group create --name yourWebAppAzureResourceGroupName --location region
az appservice plan create --name appServicePlanName --resource-group rgname --is-linux
az webapp create --name webAppName --resource-group rgName --plan appServicePlanName --runtime "java|1.8|Tomcat|8.5"
The last command gives me the error:
'1.8' is not recognized as an internal or external command,
operable program or batch file.
So I thought maybe Tomcat is not installed on my Azure VM, which is a Linux machine. So I used the next tutorial to install Tomcat:
https://www.howtoforge.com/tutorial/how-to-install-apache-tomcat-8-5-on-ubuntu-16-04/
After this I tried to do the --runtime command again, but I still get the same error. I have no idea how to fix this. I hope someone can help me with this problem.
I tried to check the webapp list-runtimes and I get this list:
"java|1.8|Tomcat|8.5" is in here. I've tried all of the versions, but it did not work.
EDIT: It works in the Azure Cloud Shell, but then there is another error:
Linux Runtime 'java|1.8|Tomcat|8.5' is not supported.Please invoke 'list-runtimes' to cross check
I have tried all the runtime versions, but still this error. I have also tried it with double quotes
I bet you solved your problem already, but in case others find this and are using PowerShell to run Azure CLI commands. This is what worked for me.
The problem is in how PowerShell interprets the pipe, '|', character inside the --runtime parameter, when evaluating the whole line.
Add the --% to be beginning of the command to turn off PowerShell evaluation of expressions, as suggested in the code block here.
Note: this will also stop PowerShell from evaluating any variables inside the command. What you can do is move the --runtime to the end of the line to get around this problem, e.g. like this
az webapp create -g $rg -p $appPlanName -n $appName --deployment-local-git --% --runtime "DOTNETCORE|3.0"
ok, i got it, that list is for windows webapp, not linux. for linux use:
az webapp list-runtimes --linux
so working solution:
az webapp create --name yourWebAppName --resource-group yourWebAppAzureResourceGroupName --plan yourLinuxAppServicePlanName --runtime "TOMCAT|8.5-jre8"
The following command is based on a code snippet I found in the official documentation to create a Linux Service Fabric cluster.
Originally it was bash script, but that's not available on my private build agents (requires windows insider program??) so I switched to batch script.
I wonder why the following command fails:
d:\a\r1\a>call az sf cluster create --resource-group "ha17aztestclustergroup" --location "westeurope" --certificate-output-folder . --certificate-password "433q6D7sdNKkd-.,6ck#6" --certificate-subject-name "ha17rsomaztestsf.cloudapp.azure.com" --cluster-name "ha17aztestcluster" --cluster-size 3 --os UbuntuServer1604 --vault-name "ha17rsomaztestkeyvault" --vault-resource-group "ha17aztestclustergroup" --vm-password $VmPassword --vm-user-name "sfadmin"
ERROR: az sf cluster: error: argument subcommand: invalid choice: create
usage: az sf cluster [-h]
{select,manifest,code-version,config-version,health} ...
The exact same inline script does work on my private build agents with AZ CLI 2.0.20 installed.
Azure hosted Agents (VS2017) has AZ CLI 2.0.14 installed.
But I doubt that's the problem.
The Hosted VS2017 has Azure CLI 2.0.14 installed, there isn’t create command for az sf cluster (2.0.21 contains), you can check it by adding Azure CLI task with az sf cluster --help command to check its commands.
So, you can setup a private build agent and do build with this agent. Deploy an agent on Windows
I ran into a similar problem whilst deploying a different resource (Function Apps). There was a bug fix in a later version than what was installed on the hosted agents.
I ended up getting around this problem by either dynamically injecting this command into my scripts or by simply having an extra Azure CLI step in my Release to update Azure CLI
pip install --pre azure-cli --extra-index-url https://azurecliprod.blob.core.windows.net/edge
Unfortunately it takes nearly 5 minutes to update the Agent but all of my Releases are reliable now.