Azure release pipeline keeps adding ".scm" to the appservice's URL - azure

I have an appservice called compspiadev, and I am using Azure's Pipelines to set-up CI/CD. Created the build pipeline and build the project into an artifact to use it in the build pipeline. When I try to deploy I get the following error:
Now my appService doesn't have the ".scm." part in it, and in my configuration I don't set the name to have the KUDU endpoint it adds it automatically:
How can I fix this issue for it to deploy correctly?

Your guess is correct. That is an network error which is because our Azure devops Hosted agent could not connect to the internal deployment endpoint of ILB ASE. (As I mentioned in this ticket, I checked your app from our backend and found it is connecting to ILB ASE.)
You can check this source code (actual working code snippet, I can not help you locate the exact code line since I don't know witch deploy method you used), and you will found that the process of Azure app deployment via Azure app service deploy task is actually the process of communicate with app files to Kudu service (xxx.scm.azurewebsite.net).
For example, if you are using Run from package type to deploy your web app, you can refer to this code snippet.
After you configured ILB ASE, per this doc, the scm site is only available at <appname>.scm.<asename>.appserviceenvironment.net. But you should have known that Hosted agent is a dynamic-distribution Azure VM that is neither in nor connected to the virtual network.
That is why you encountered the error like could not connect to the remote computer <appname>.scm.<asename>.appserviceenvironment.net.
To resolve this issue, you need use private agent to execute your deployment pipeline. For how to configure a valid self agent so that it can communicate with your private DNS, you can follow this reply or this blog.

As is visible in (the URL part of) the error message in your first image, you're deploying to an App Service Environment (which is something of a special cookie).
The Azure App Service Environment is an Azure App Service feature that provides a fully isolated and dedicated environment for securely running App Service apps at high scale.
As we can see in the second image, you don't have the checkbox "Deploy to Slot or App Service Environment" checked.
Check that checkbox, specify the Resource Group name, leave slot name set to production and you should be good to go.
If the deployment target is an Azure App Service environment, leave the slot name as production and specify just the Resource Group name.
Source: Azure App Service Deploy task - Prerequisites for the task

Related

How to deploy WAR files on different Deployment slots within a single App Service on Azure portal without dividing the traffic

On Azure Cloud Portal I have one App Service Plan and under that I have one App service in which I have created some Deployment Slots, you can refer the below screen shot.
I have provided traffic % as per the requirement, now what happening is when I am triggering a request to my main App Service which is "wa-45210-jira-stg1-win" then it is routing through properly but when others are trying to trigger the request to same App service then it is getting redirected to other deployment slots like "wa-45210-jira-stg1-win-test". Please refer the screen shot below
Here the expectation are it should redirected to the desired app service for which the request has been triggered so that I can have dedicated deployment slots for particular environment.
I think traffic is getting divided because of the traffic % defined. If one app service is occupied then automatically the request will get redirected to other deployment slot which is not expected.
Can anyone suggest me What should I do in order to achieve this?
My goal is to create some deployment slots or something like that in one single app service so that I can manage Dev, Test & Stage environment related stuff in one App service and therefore I can save the cost.
Can anyone suggest me What should I do in order to achieve this? My
goal is to create some deployment slots or something like that in one
single app service so that I can manage Dev, Test & Stage environment
related stuff in one App service and therefore I can save the cost.
Yes, we can achieve the above requirement . To make sure that you have selected the correct target deployment slot which need to be trigger.
For example:-
Also make sure that ,
production is your target slot and that all settings in the source slot are setup exactly as you want them in production before swapping
an app from a deployment slot to production.
For complete configuration please refer this MICROSOFT DOCUMENTATION|Set up staging environments in Azure App Service
For more information please refer this MS Q&A as suggested by #ajkuma-MSFT.

Azure Devops deployment group auto-configure script fails on Azure VM unable to access: vstsagentpackage.azureedge.net

I need to push a DevOps website from azure to IIS on Amazon or Microsoft (or locally).
When I run the script in the Azure VM, I get the error the domain vstsagentpackage.azureedge.net isn't accessible. I assume this is for advanced internal azure networking reasons.
What is the most appropriate way to publish one DevOps site into one IIS Web(app) site while others are running and perhaps managed by others? I'm currently using this approach.
I'm not sure if you have permission to, but if you do, I'd recommend setting up a deployment group or agent (deployment group for classic pipelines, agent for YAML) on the Windows Server hosting the site.
Once you set up a deployment group/agent, you'll want to configure your release pipeline to be set to use the newly registered agent or deployment group within your pipeline.
If you're using a classic (UI) pipeline, you'll want to add a new Deployment Group Job by clicking the ellipsis to the right of your stage name:
After you've added the deployment group job, you'll want to select the deployment group you've just added:
With that configured, you'll be running your pipeline on the IIS server you're deploying to, and you'll just need to add the IISWebAppDeployemntOnMachineGroup#0 task to your release pipeline and point to the site you're deploying to:

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 CI/CD pipeline for Angular 8 APP using Azure Deployment Groups

I have “.Net Core Web Api” and “Angular 8” projects. I am manually deploying these two application on Azure Virtual Machine.
Now I want to use Azure CI/CD pipeline process and deployed above application on IIS present on above Azure Virtual Machine.
Can I achieve above tasks by using Azure Deployment Groups? I am not able to find proper solutions on internet.
Any help will be really appreciated.
I have this link: https://learn.microsoft.com/en-us/azure/devops/pipelines/apps/cd/deploy-webdeploy-iis-deploygroups?view=azure-devops but no use.
Can I achieve above tasks by using Azure Deployment Groups?
Of course sure. Azure virtual machine just the VM which hosted by Azure, there's no more difference with the normal VM.
To deploy application to Azure VMs through IIS tasks and azure devops deployment group, you must pay attention to below 2 prerequisites:
1) As normal, VM is a separated machine. In order to combine them into Azure Devops and use them with CI/CD, to be precise, let the Deployment group manage to these virtual machine, you need to run script to register these VMs to VSTS deployment group.
2) Also, to deploy application to VMs via IIS, you need also ensure that these VMs web servers configured with IIS.
Above 2 is what mentioned in the doc you shared.
Our lab published a blog which describe the very detailed steps on how to Deploying to Azure VM using Deployment Groups. You can follow it to continue your configuration in VSTS pipeline.
Since it is very detailed, I would only point some key to you:
1 To configure Deployment Group agent on each of the virtual machines, firstly, please use Azure Resource Group Deployment task with Configure virtual machine deployment options action and enable prerequisites as Configure with Deployment Group agent:
2 For the configuration of IIS manage and deploy task, including physical path and etc, you can follow this(just ignore its task of start) to finish your configuration.
Note:
Here you must add 2 phases since Azure Resource Group Deployment task need run with agent job, and IIS web app manage/deploy task run with deployment group job
These are the basic steps which could help you achieve what you want.

Pass Azure service connection into variable in Team Services

In Visual Studio Team Services, I would like to specify the Azure Subscription via a variable (see image below). The reason for this is that our ops team maintains the NON-PROD and PROD environments on different subscriptions.
However, when I do this I get the following in the log:
##[section]Starting: Azure App Service Deploy: XXXXfunc
==============================================================================
Task : Azure App Service Deploy
Description : Update Azure App Service using Web Deploy / Kudu REST APIs
Version : 2.1.10
Author : Microsoft Corporation
Help : [More Information](https://aka.ms/azurermwebdeployreadme)
==============================================================================
[RESOURCE_NAME] exists false
##[warning]Can\'t find loc string for key: CouldnotfetchacccesstokenforAzureStatusCode
##[error]CouldnotfetchacccesstokenforAzureStatusCode 401 Unauthorized
##[section]Finishing: Azure App Service Deploy: XXXXfunc
If I set the subscription using the drop down, then it all works fine.
Is this possible to do? If so, how?
UPDATE:
I am using App Service here as a simple example, but I also have a collection of Azure PowerShell tasks joined into a single Task Group. Each of these tasks need to have the subscription specified. If I can't pass a Azure sub in, then I'll have to either clone the Task Group or just list each step individually.
Its easier (and fits with how the system has been designed), if instead of this, you just use the Releases workflow to setup your dev/test environment, with the app service deploy pointing at that subscription, then clone that environment, call the new one "prod", and modify the release step in that environment to point at the other subscription. You can then also add governance (ie. email approval processes) around the build and deploy, and ensure the exact same build artifact is deployed to both environments, but when you want them to. I wrote a blog post last year to take you through this step by step, see https://russellyoung.net/2016/11/09/continuous-deployment-of-a-asp-net-core-app-to-azure-using-vsts/

Resources