I am working on the Azure functions. When I deploy the function to Azure portal, I am unable to find the function and function files in the wwwroot folder. The complete code is here How to get the path of .py files under Azure function in Azure portal
Someone please advise.
Related
I'm new to Azure function and here found after the function is published to the portal, but it is not visible in the function list. I have attached the snap of sample code and an empty list of azure. plz, help!
////////////////////////////////////////////////////////////
Adding kudu ui, here I found the only host.json in /wwwroot
Hi All
Added kudu ui, here I found the only host.json in /wwwroot
Update:
From your description, it seems the deployment of your azure function is Interrupted or failed. There will be a host.json in wwwroot by default. If you deploy from local, it means it create function app success but didn't upload files to physical path 'wwwroot' (Azure function is based on azure app services sandbox, so if your deployment is success, all of the related files and folder will be upload to wwwroot, this is the physical path, just like the app service. ) I think you can try other ways to upload these files to physical path. For example, ftp deploy or zip deploy. This is the structure of the C# library azure function:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-dotnet-class-library#functions-class-library-project
This is the screenshot of the success deployed function:
(In bin directory, there are many compiled files, including the dll file. In Function1, there is a function.json. These files will be generated after building. For more information, please refer to the above doc.)
You can first build your function app on local and then upload the compiled files to azure.
These are the tutorials of how to use ftp and the zip deploy to upload files: (Just choose one of them is ok. By the way, when you use the VS 2019 to publish function app, it is essentially a zip deployment.)
FTP deploy: https://learn.microsoft.com/en-us/azure/app-service/deploy-ftp
Zip deploy: https://learn.microsoft.com/en-us/azure/azure-functions/deployment-zip-push
Original Answer:
This is an error of portal ui.
It seems that the new version of ui has not been done. But your function should have been deployed to azure.
If you go to kudu, you will find the files has be upload to wwwroot.
You should follow these steps:
And then copy the host key in this place:
(Both of them can be used.) Copy one of them to the end of your request url.
The request url in your function app should be like this:
yourfunctionappname.azurewebsites.net/api/yourtriggername?code=yourkey
And then you can get response.
You can try again at your time, the problem maybe be fixed.(Whether you can see it in ui, you can trigger this trigger, but you need to give a key to pass the verification. The new version of the function ui still has a lot of updates, and even lacks some basic functions. It is trying to unify towards app service, and it should be stable after a while.)
During the Azure Release pipeline, I would like to copy a file in a Git repo to the wwwroot directory in the app service. The output from the task says it copies the file but it is not there. I am thinking I am not specifying the target folder properly. I currently have it as d:\home\site\wwwroot. Thanks for any help.
Copy file to Azure App Service During Release Pipeline
You could not use the copy task to copy a local file to the Azure app service. This task only supports local replication.
When you set it as d:\home\site\wwwroot, the copy task will copy the file to the folder in the agent, which runs this task rather than the Azure app service.
To resolve this issue, you could use Azure App Service Deploy task to deploy this file to the app service. In this task, set "Package or folder" path to the folder where the file exists.
Or you can consider the advice of Leo Varghese, to use the FTP upload task to copy that file to the app service.
Hope this helps.
#Doug, You an make use of the FTP upload task to copy a file in your build artifact to the wwwroot folder. Assuming your file in gitlab is present inside the artifact after the execution of build pipeline.
Please refer this article -> https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/ftp-upload?view=azure-devops
For performing FTP upload you will need your FTP credentials available for your web-app. This can be obtained from the Deployment Center of your web app.
Hope the above answers your question. Please let me know if you have any queries on this.
i have created a function app using blob trigger. The purpose of this function is whenever the blob created, it has to transfer/copy the file from blob storage container to appservice wwwrrootfolder where my web application resides.
Not exactly using Azure Function, but I think the easiest way is using Logic Apps + Blob Trigger and FTP connectors:
https://learn.microsoft.com/en-us/azure/connectors/connectors-create-api-azureblobstorage
https://learn.microsoft.com/en-us/azure/connectors/connectors-create-api-ftp
https://blogs.msdn.microsoft.com/kaushal/2014/08/01/microsoft-azure-web-site-connect-to-your-site-via-ftp-and-uploaddownload-files/
I have a zip file in a container under an Azure Storage account.
I want to download this zip file as a pipeline task after the deployment of the .NET Core app to an Azure App Service slot (Azure DevOps). The front-end (index.html) of this app is in this zip file, which must be downloaded/extracted to the wwwroot.
I tried it with a Azure PowerShell script: InlineScript task but there is no wwwroot folder available as seen in the Kudu debugconsole of the App Service.
Is there a(n easier) way to achieve this?
I'm not sure I quite understand the issue (you're deploying a webapp, then you want to download another zip from blob storage, and deploy that to the same webapp?), but I'll have a stab at it.
Deploy the webapp with Azure App Service Deploy task as normal.
Add an Azure PowerShell task, which will run on the Build Agent, not on the webapp, so it won't see the wwwroot folder. It can however run Get-AzureStorageBlob to download the zip, save it locally in a local folder (like $(Build.ArtifactStagingDirectory)/tmp or something).
Have an Azure App Service Deploy deploy it ($(Build.ArtifactStagingDirectory)/tmp/*.zip) up, just make sure that you haven't selected "Remove additional files at destination" when you do the second deploy or it will wipe the first site out.
How does Function App detects if a folder contains Functions?
As an incentive for the upcoming Azure Function Tools for VS, I followed the article here: https://blogs.msdn.microsoft.com/appserviceteam/2017/03/16/publishing-a-net-class-library-as-a-function-app/
I have successfully created Azure Function as a web-app project in Visual Studio, deployed the Function App using ARM template, then deployed the Functions using release step in Visual Studio Team Services.
Here are the contents of my Web App project, 'CustomerERPChange' is the Function that I want to get it showing in Azure.
Web App Project
What I'm expecting to see is the Function appearing in the Function App, but that doesn't seem to be the case..
Looking at Kudu I can confirm that the content of my project has been successfully deployed to the ../wwwroot directory, renaming the 'run.cs' back to 'run.csx' also didn't help.
Any idea and suggestion would be appreciated, thanks!
There are two ways to create function within Functions App,
1) using UI Create function with template of your choice,
2) from KuDu portal,
go to your_app_name.scm.azurewebsites.net,
create a folder in home > site > wwwroot > (function_name),
add run.csx or run.ps1, and function.json file to the newly created folder.
About these files :
run.csx or run.ps1 is a file which will automatically gets called when the function is executed.
function.json is a file which defines your function(either it is a timer or HttpTrigger, or other).