Publishing Azure functions - azure

I work with several azure functions on a project that I didn't setup on my own, and when I try to publish the project which includes those azure functions to update them, the publishing failed with the following error :
Web deployment task failed. (Connected to the remote computer
("demo.scm.azurewebsites.net") using the Web Management Service,
but could not authorize. Make sure that you are using the correct user
name and password, that the site you are connecting to exists, and
that the credentials represent a user who has permissions to access
the site.
Where do I provide credentials ?

Here are the steps to publish an Azure Function from Visual Studio.
Go to the Azure Portal
Go to your Function App.
Then, select Overview and click Get publish profile and save the file.
Next, go to your Visual Studio project.
Right-click on your Azure Function project.
Select Publish and then Import Profile.
Finally, hit publish.
All the information needed, including your missing credentials, is in that the profile.

I have the exact same issue. Tried to publish and get the exact same error. I did as kzrystof suggested and downloaded the publish profile from the Azure portal and imported it into VS2017. As soon as I pick the publish profile file and click the open button I get the "Publish failed" error message. I checked the output window to find out what the error was, but there is nothing new added to the output. I cleared the output window and clicked the Publish button and immediately receive the "Publish failed" error popup with no further details in the output window.
Update: I was able to successfully publish the Azure Function App by creating a new profile in VS2017 to a new instance up on Azure. I then removed the old instance from the Azure Portal. Successive attempts to publish from VS2017 then worked successfully.
Just as a test, I downloaded the publish profile from the Azure Portal for this new AF app and imported it into VS2017 and still this produces the same "Publish failed" error popup. MS still seems to need to do some work on that scenario.
Also, there still seems to be problems with ZipDeploy so avoid it for now. I keep having timeouts when trying to publish using ZipDeploy. Standard WebDeploy publishes the files individually and thus doesn't have timeout issues.

Related

Why is webjob log not showing proper failed message?

I am trying to execute a manually triggered webjob. The system automatically gets failed without showing any proper failed message. I even added application insight to the program but i can't see any failed log in application insight as well.
My main application calls different interfaces and methods from different projects. I have linked all of them by adding references in my main project. I uploaded my webjob simply by using visual studio 2017 feature Publish Azure Webjob
App.config screenshot:
I have couple of connection to Azure file share and one for Database(Microsoft SQL Server)
When I am uploading .exe file from bin>release and then when i am running it this error message is showing up:
The issue is with adding reference to class library from my console application. Although the issue still persist but now at least I know where I am going wrong.
We have reproduced the issue from our end and faced the same problem while deploying the webjob from Visual Studio.
But we have successfully able to run the webjob as you can see in the below attached screenshots for your reference.
Points to be re-checked from your end to publish the webjob to azure app service without any errors:
Make sure after creating the webjob ->open the app.config file in the VS and add the below configuration properties under the <configuration>:
<add name="AzureWebJobsDashboard" connectionString="place your storage account connection string here"/>
<add name="AzureWebJobsStorage" connectionString="place your storage account connection string here"/>
We have used runtime .net framework as Version=v4.7.2 in Visual Studio 2017.
Note: copy and paste the same storage account connection string for both the above properties in app.config file i.e. AzureWebJobsDashboard and AzureWebJobsStorage.
After adding these properties in the app.config file -> save it and right click on the solution explorer tab in Visual studio and build:
Then publish to azure from the solution explorer tab in VS:
Now go to the App Service in azure portal and select webjobs then run the webjob and click on the logs tab to show the results page as shown below:
If the webjob gets successfully deployed then you can see the status as Running like in the below screenshot:
If there are any Errors after the deployment then you can see the error messages by clicking the toggle output screen and troubleshoot based on the error message like below:

Azure App service Deploy fails with Error: 'credentials' cannot be null

I have a portal account, and a devlops account. Both happen to use the same login/password.
In the portal.azure.com, I have a working web service.
Under the web services "deployment-Deployment center" I select azure repos, azure pipelines as the build provider, set master branch etc.
It created a pipeline in my devlops which worked, i.e. it did NuGet restore, build solution, test assemblies, publish symbols path, publish artifact.
Great.
But it did not deploy the new build.
Clicking on "releases" in pipleines in devops, it was trying to use "Azure web app deploy" and giving an error that msbuild doesnt use the right format or similar. So I changed it to "Azure App Service Deploy".
Now I get a new error: Error: 'credentials' cannot be null.
There is no field for credentials.
It is using a publish profile.
Any ideas how I fix this?
here is the offending task:
There is no option to configure the missing credentials?
If I go to portal, and look at the "Deployment center", I see this:
If I click on "deployment credentials" I see this:
Which all looks good.
Any idea where the "null" credentials comes from?
Have you tried adding a new service connection in Project Settings and selecting Service Connections there? Even updating the Service connection created by Azure Portal threw an error for me.
In my case the issue was I did not have proper access rights to allow the connection between my pipeline and the Azure App. I was listed as a Contributor on the subscription. I contacted our company Devops and she updated the service connection without any issues because she was listed as an Owner or User Access Administrator.
Use "Azure Web App" task instead. Create a service connection using the publish profile route then use it within the task. Make sure you tick off "Deploy to Slot or App Service Environment" and it should work.
Have a read on this. They updated the services. You need to follow the Action Required.

Azure function not found after publishing using Visual Studio 2019

I'm testing Azure Functions for the first time using VS 2019 and this guide: https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-your-first-function-visual-studio
When I run the function locally, everything works fine. Then the guide tells me to use VS to publish the app to my Azure account, which I do successfully, and I see a newly created function app in the Azure website:
But if I try to call the function using
https://functionapp220200104024331.azurewebsites.net/api/Function1
as I'm supposed to, I get a 404 error.
If I look at "Functions" at the Azure portal, I see none:
and I think I should see "Function1" there, but it is not listed.
Am I missing something?
It looks like the functions got created successfully, bit did not get published.
The publish flow in Visual Studio first enables you to create a Function App to publish to, but it's only the last 'Publish' step that actually deploys something to Azure. Are you sure you clicked the button labelled 'Publish'?
You can open the 'Web Publish Activity' or 'Microsoft Azure Activity Log' Window under View > Other Windows which should give you some more information on if the publish happened.
You can go to https://functionapp220200104024331.scm.azurewebsites.net (it runs Kudu) to get some more insight into what is and what isn't available.
First, as rickvdbosch says, maybe you don't click the publish button. The Visual Studio create the app service on Azure and wait for you to publish.
Second, Given that the function is not shown under your functionapp, I think this may be a deployment failure. That means you publish to azure but the function is not publish successful. If your function app is created by local. It will publish dll file and the function app will be 'readonly'.
This is your functionapp, you can see there is a plus sign here:
But if you deploy successfully, your function app will be like this:
(Without a plus sign and cannot be edited.)
So I think there is no function under your function app.
You can take the following steps to test my judgment:
If you deploy successful, you will find your function here, a .dll file. But as your description, I think you deploy failed.

Can't run Azure WebJob ManualTrigger attached to Azure WebSite

I have created an Azure WebSite in Visual Studio. I then added a Azure WebJobs project through Visual Studio. I then provided the connection string to my storage account to both the app.config file of my WebJob project and the web.config file of my WebSite project.
I still cannot get the job to complete successfully. It keeps failing, as I can see that on the Dashboard. When I go to the Dashboard, not only do I see the job failing every time I run it, I also get a red notification that my connection string is incorrect for the AzureWebJobsDashboard. I've provided this connection string in both projects, and I've copied from the Azure Portal, so there is no way I'm getting the connection string wrong.
How can I fix this? I'd like to start creating real WebJobs, but I can't even get the example one to work (the one given to you as a ManualTrigger when you add a WebJob project in Visual Studio).
update
I had forgot to mention that this connection string is also in my application settings in the azure portal already and I still see failures.
Try adding the connection strings on the Application Settings page of your WebApp in azure.
UPDATE
Use a General-purpose storage account to get rid of
System.InvalidOperationException exception.

Cannot set deployment from source control for Azure App Service

Am trying to setup deployment from source control for Azure App Service. Am facing errors in the same. The error that am receiving is:
Cannot create build definition as no hosted build controller could be found.
Am trying to configure this via "Visual Studio Online" option by clicking "Setup deployment from source control" in a slot of Azure App Service.
There are two issues in your question:
For the New Portal, it can only show the projects with Git Version Control. If you project is using Team Foundation Version Control(TFVC), it cannot be listed. You can refer to this question for deteails: Azure Functions deployment source Visual Studio Team Service project.
For the Classic Portal, I can get the same issue with you and it is caused by the failure when create a XAML build definition. When you create a XAML build definition from VS directly, you should get a similar error message:
I have help you submit a feedback on Microsoft Connect Page, you can track the detailed information here: https://connect.microsoft.com/VisualStudio/feedback/details/2699963
Update:
According to the information in Microsoft Connect Page, there is no Hosted Build Controller for new VSTS account. So you need to setup your own on-premise build controller to fix the issue for Classic Portal.

Resources