How to turn ON/OFF https during the Azure release? - azure

I would like to turn ON/OFF HTTPS Only of my website during the pipeline execution.
Set-AzWebApp -ResourceGroupName $(ResourceGroupName) -Name $(WebAppName) -HttpsOnly $flase
I am using private windows agent.
I am getting following issue
I have Az installed on my server.
Could you please help me?

To use Azure ClI task you need to follow below prerequisites
A Microsoft Azure subscription
Azure Resource Manager service connection to your Azure account
Microsoft hosted agents have Azure CLI pre-installed. However if you are using private agents, install Azure CLI on the
computer(s) that run the build and release agent. If an agent is
already running on the machine on which the Azure CLI is installed,
restart the agent to ensure all the relevant stage variables are
updated.
According to your error log, seems Azure CLI is either not installed properly or detected by Azure DevOps.
Please make sure you have restarted the build agent to ensure all the relevant stage variables are updated.
Besides, you could also try to use Azure CLI on the private agent directly check if you are able to use above Azure command to turn off https. This will also narrow down your issue.

Related

How do I add the azure-devops commands to the Azure CLI in an offline on-premise server?

I need to add the azure-devops extension to the Azure CLI on an on-premise Azure DevOps Server, in order to use the az devops commands.
The server does not have an Internet connection.
Running the following az extension add --name azure-devops attempts to connect to the Internet.
How do I add the azure-devops extension in an offline server?
It is possible: Go to https://dev.azure.com/ms/azure-devops-cli-extension/_build, search for the Create Releases pipeline, download the published artifact and store it locally.
Then run az extension add --source <download location>\azure-devops-cli-extension\azure_devops-0.20.0-py2.py3-none-any.whl
You can't, as it only supports Azure DevOps Services, as it states on the extensions marketplace page.
You can download and install VSTS-Cli (https://learn.microsoft.com/en-us/cli/vsts/overview?view=vsts-cli-latest) to you on-premise environment.
It is almost same as Azure-Devops.

Azure DevOps (VSTS) - using Azure Az PowerShell on a Hosted Agent

We use Azure DevOps with a hosted VS2017 build agent. We would like to use the the new Az PowerShell module. However, the VS2017 hosted build agent has AzureRM installed on it. The documentation states You should not install Az side-by-side with AzureRM. Remove all AzureRM modules before installing Az. and this indeed is necessary because the two conflict. There is also no Az PowerShell build task.
So the question is, how do I use the Azure Az PowerShell module from an Azure DevOps hosted VS2017 build agent?
I suppose the answer is - you dont (for the time being). Because you wont have permissions to remove the azure powershell module. Ok, apparently you can do that.
Another way to make it work, use a docker container as a build agent (inside hosted agent). That can have Az module, obviously.
They cannot be installed side by side, however one can be installed in PowerShell (non core), and the other in PowerShell Core.
From the comments in the docs you specified:
Question: The document says not to install the modules side-by-side but is there any reason that we cannot run AzureRM in PowerShell 5.1 and AZ in PowerShell Core on the same machine?
Answer: No, no reason at all. In fact we are thinking of suggesting this as an advanced scenario for those with a substantial investment in AzureRM scripts

AKS: CI/CD pipeline using AKS

I'm trying to figure out the steps to setup CI/CD for an Asp.Net Core web application using AKS with VSTS. Are the steps described in https://learn.microsoft.com/en-us/vsts/build-release/apps/cd/azure/deploy-container-kubernetes valid for what I'm trying to do? Are windows container supported in AKS?
If your application is in ASP.Net Core, then you can host it in Linux as your code is platform independent. I have done this using Docker-file where your container is a self hosted app running on AKS.
VSTS provides a Inbuilt task to deploy to your AKS cluster in your build pipeline.
Windows support on k8s is better with Windows Server version 1709 which needs Kubernetes v1.9 (bleeding edge stable). See https://kubernetes.io/docs/getting-started-guides/windows/
Unfortunately, at this time, AKS preview only supports up to 1.8.2.
Frosty, if you can create a docker image out of your Windows machine, it can be pushed to the container registry and then deployed to Kubernetes cluster. Here are some links for reference:
Building and Pushing Windows container images: https://blog.docker.com/2016/09/build-your-first-docker-windows-server-container/
Install Azure CLI: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest
Create Kubernetes cluster in AKS: https://coderise.io/kubernetes-cluster-on-azure-container-service/
Windows containers are in private preview in AKS (reference); you can sign up using this form.. You can run hybrid clusters (Linux+Windows, up to 1803) using acs-engine today.
The VSTS walkthrough you linked is valid; check also this one and this one.
Update: Windows support for AKS is still a work in progress.
Currently Windows container are only in private preview, and you need to enable it using Azure CLI do some steps, please refer this official docs: https://learn.microsoft.com/en-us/azure/aks/windows-container-cli. After you enable it, then you can check the 'Windows Container' option when you create node pool in your azure kubernete service account.

How to deploy an angular2 application as a webapp in azure

Can someone help me deploy an angular2 application as a webapp in azure. I have a github enterprise setup. On my Jenkins server, I would like to do a no build. On successful completion of the build, I'd like to push it to a webapp.
Every deployment I attempted, failed on npm of one form or other. I don't want to create a VM and deploy a server.
I'd appreciate any help on this.
Deployment of all supported web applications to azure web app service ( PaaS and not IaaS VM as per your requirement) is possible by the following options
from git CLI you can publish the code from your local repository to azure.
linking an online repository like bitbucket, gitlabs to azure
Powershell - publish code from your local repository to azure
Azure CLI - publish code from your local repository to azure
FTP option is available as well.
Check out this post to see how you can publish using git commandline https://learn.microsoft.com/en-us/azure/app-service-web/app-service-deploy-local-git

Deploy azure worker role outside of visual studio with diagnostic setting

We are creating the azure worker role deployment package via our ci server and deploy the package to the azure cloud service using Azure Powershell cmdlets script.
however the diagnostic configuration does not get apply to the deployment; it only works when we deploy manually from within visual studio.
is there a way to do that in the powershell script to take into account the diagnostic setting (performance counter..etc) ?
You can use Set-AzureServiceDiagnosticsExtension PowerShell Cmdlet to enable diagnostics. You may find this link useful for this purpose: http://azure.microsoft.com/en-in/documentation/articles/cloud-services-dotnet-diagnostics/ (Please see Step 5: Install Diagnostics on your Worker Role).

Resources