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

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.

Related

Deploy Azure AppService to Url: 404 + no worker is assigned to the app service plan. The site cannot serve any requests

I'm getting a 404 trying to access my azurewebsite.net
My Resource group contains an AppServicePlan, an AppService, SQL Server & SQL Database, a KeyVault & SignalR.
Locally everything works, the AppService is running, AppServicePlan is Ready (1App/0Slots),
Connected Services for SignalR & SQL are configured (in the menu you get when right-clicking WebProject > Publish). KeyVault is configured & accessible. Not sure if these are problem free though, as I keep getting NuGet Errors, stating unable to update NuGet Package.
When I right-click my WebProject & Publish, I get Message Publish has been succeeded. But when I click on the link, I get a 404.
I'm working with two pipelines in AzureDevops
Seeing as official documentation is always lagging behind and showing older interfaces, it has not been much of a help.
I followed https://learn.microsoft.com/en-us/learn/modules/create-release-pipeline/5-deploy-to-appservice this tutorial, did everything stated, but the last step, I didn't get the desired result (an accessible website through azurewebsites.net).
I have a Export template with all connected services configured (I guess generated by azure?) but don't really know what to do with it.
Can anybody pinpoint what I am missing or doing wrong? Or tell me what else I would be needing, apart from the services I mentioned (like Certificates, Active Directory?)
Do I need a gitHub repo next to AzureDevOps Repo & Azure Resources?
Does publishing via VS interfere with my automated pipelinebuilds?
Thanks!
You can try to deploy to Azure App Service in Azure DevOps directly. I used the sample you shared and worked well on my side. Here are my steps:
1.Create the App Service instance in Azure and make sure the default home page is correct.
2.Clone the sample from GitHub to Azure DevOps Repo.
3.Change the deploy stage in the azure-pipelines.yml file on release branch and run pipeline. I removed variable groups and changed the configuration of AzureWebApp task:
4.Browse the page in Azure. I can get the same page as in the tutorial.

Azure Function App Deploy from Azure Build Pipeline: 'credentials' cannot be null

I am trying to create a build pipeline in Azure DevOps to deploy an Azure Function Application automatically as part of a continous integration pipeline. When the Function App Deploy step is run, the step fails with 'credentials' cannot be null.
Does anyone know why this happens?
My Build Pipeline:
The Log output when the step runs:
The only thing that I think that it can be is the Azure Resource Manager subscription which I am using Publish Profile Based Authentication however I have managed to create a similar pipeline for a web application with a deploy option using this authentication and it worked successfully. I just cannot deploy the function application.
This same problem also ocurrs with publishing web apps I found. There are two different tasks that can be used for web apps to publish and you have to use the right one.
There is a task called Azure Web App Deploy that works.
Also a task called Azure App Service Deploy that doesn't.
This is with Publish Profile Based Authentication.
I found that to deploy the Function Application you can also use the Azure Web App Deploy task and it seems to work.
Just for a bit of context on this one.
The Azure Functions task will allow you to select - and even create - a Publish Profile based service connection. No warning is given, but - looking at the code - the task doesn't implement the needed fetching of the push profile.
At least the task - when selecting the service - should warn you that it doesn't handle Publish Profile authentication. At best they should implement it.
For the nerds in here, even more detail.
For tasks that work with Publish Profile authentication - like for example the Web App Deployment - you have something like this happening:
if (Service Endpoint is Publish Profile) {
publishProfileUtility.getSCMCredentialsFromPublishProfile();
}
Look at the link for the actual code.
On the other hand the Azure Functions will simply create the service with the passed endpoint and hope for the best.

Azure DevOps Service Connections not showing when setting up a new release pipeline

I have setup a Service Connections within Azure DevOps to my Azure Subscription. It uses a certificate to connect. When I create a new pipeline and select the task Azure App Service Deploy.
In the drop down box for Azure Subscription I see nothing under Available Azure Service Connections, but I see my various Azure Subs under Available Azure Subscriptions.
Anyone Know what this could be? Is there some permission I am missing?
I have been looking about online and cannot really see anything.
You probably need to run your agent on a different type of virtual machine, please see Picture 1 below.
Try selecting a different OS and add a new task based on your selected vm. Also note that your service connection may not be available for the selected task as you can see in Picture 2 and Picture 3.
*Assuming you have already enabled pipeline permissions from the project settings in your repo.
Hope it helps.
If you are talking about below in the UI, select the connection name you assigned in the Azure subscription (or the equivalent connection name) setting of your pipeline.
Next you must authorize the service connection. To do this, use one of the following techniques:
If you want to authorize any pipeline to use the service connection,
go to Azure Pipelines, open the Settings page, select Service
connections, and enable the setting Allow all pipelines to use this
connection option for the connection.
If you want to authorize a service connection for a specific
pipeline, open the pipeline by selecting Edit and queue a build
manually. You will see a resource authorization error and a
"Authorize resources" action on the error. Choose this action to
explicitly add the pipeline as an authorized user of the service
connection.
We had the same issue with the Service connection not showing up.
We had 2 projects configured in Azure Devops and each project had a service connection defined with the same name.
It turned out that Azure Devops couldn't handle the duplicate name. We renamed one and everything was fine again

Publishing Azure functions

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.

Azure cloud service deployment issue

I uploaded the pkg and confi in azure portal for deploying in staging environment and azure portal shows notification that 'Successfully started to deploy application...successfully started to deploy application to the staging environment for cloud service ...". There after no error or notification, neither the deployment ever visible/happen. What to look for? I looked into activity logs and there is operation
Write DeplymentSlot" with status Accepted.
There is a bug in the new Azure portal. It upload the faulty config file. If in the ACL the ip in quote "x.x.x.x" is replaced with "`x.x.x.x" (note the apostrophe after double quotes) then the new portal upload the file without any error but the deployment shows strange behavior. it notify successful deployment but actually nothing deployed. Also the deployment label got updated with one that actually failed to deploy. The old portal is come as rescue as it is able to catch the bug in first place. Hope Microsoft azure team will look into this.

Resources