create Self Hosted Integration Runtime on Azure Windows VM - azure

I am using an Azure DevOps pipeline that is basically a series of steps that call PowerShell scripts that take in parameter values and within the PS script the "Az module commands" are called - these commands create the infrastructure on Azure.
For example...
Create a public static IP address - this I can do.
Create a NIC and link static IP address - this I can do.
Create a Synapse Workspace and 'Self Integration Runtime' - this I can do accept link Synapse SHIRT to the self-hosted integrated runtime on the Azure VM.
Create a Windows VM (datacenter 2019) - this I can do.
Create a Azure Windows VM self-hosted integration runtime via devOps pipeline???
I now want to create a step in the devOPs pipeline (maybe an ARM template or PS script that calls an Az module) that automatically installs the 'self hosted integration runtime' on the Azure Windows VM - the VM is attached to an Vnet/subnet. The runtime on the Azure VM will be linked to the Synapse runtime. (note I am not using Data Factory)
I have read the following. But can't workout if setting up a runtime on the Azure VM and Synapse and linking them is possible and if it can be automated in a devOPs pipeline?
https://learn.microsoft.com/en-us/azure/data-factory/create-self-hosted-integration-runtime?tabs=data-factory#considerations-for-using-a-self-hosted-ir
The below link is very near to what I want to achieve....
https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.compute/vms-with-selfhost-integration-runtime

Have added one manually step once the devOps pipeline finishes.
Open RDP port on Azure VM. I know the admin. username and password. Log on to the Azure VM.
Turn off advanced security features on the VM temporally.
Download and install the SHIRT from the Microsoft web-site.
Config. SHIRT with the "Key1" value from the SHIRT in Synapse.
Turn on advanced security features on the VM temporally.
I mark this site down -2 for poor editing buttons, worst I seen in 25 years in IT.

Related

Execute script on Azure Windows VM via Azure pipeline

I am using third party software for master data management. This software does not have API's to perform deployment across environment. It has command line utility which needs to be installed on machine and call the commands to perform the installation. I am looking to automate this solution using Azure Devops pipeline. What I am trying to do is as below
Create windows VM in Azure and install command line utility on it.
Store script in some folder in the VM.
Use Azure pipeline to call this script which is stored in my VM.
I don't even know if it possible to do such things. I tried looking on internet on how to call script stored in VM via Azure pipeline but didn't find any useful link.
If any one has done such activity or have an idea how can it be achieved please help.
this can help you
Running the command line in a Azure Virtual Machine is fully supported in Azure Pipelines. You could install a self-hosted agent in the VM.
Before that, I recommend that you could create a new agent pool for the self-hosted agents. Please go to the organization settings -> Agent pools-> click the "Add pool" -> choose the "self-hosted" type.
Then, you could refer to this document to complete the installation. When you configure the agent, you could choose the new created agent pool.
After installation, you could create a pipeline, choose the new created agent pool and add a Command Line task to run the command line. Of course, if you have many agents in the same agent pool, you could also set the demands in the pipeline to specify one agent.
reference : Is it possible to run a command line in a Azure Virtual Machine from Azure DevOps pipeline?

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.

Azure DevOps release pipeline with Azure Application Gateway and Virtual Machines

My target is to create Azure Resources from Azure DevOps release pipeline. Resources that are created are virtual machines and application gateway (+ all the necessary vnet's etc.). Resources are created successfully, but the pipeline wont work through application gateway. Currently the pipeline has "Azure File Copy" -task to copy some scripts to the virtual machines. This setup works without application gateway but I cannot get it to work with application gateway.
Error message I get from Azure DevOps is: "Unable to get FQDN for all resources in ResourceGroup"
I have created a ticket to MS but they were not able to resolve this issue ("Works as expected") yet and now waiting for Azure DevOps support to participate, but since it is a bit slow I decided to post a question about this here since I think that someone might have bumped into this before as well.
Does anyone have idea if this setup is supported or have any workarounds? Main need would be to copy and execute scripts in virtual machines.
Talked with Azure Networking team and Azure DevOps team and there is no way around this at the moment. Virtual machine must have public IP address to use "Azure File Copy" -task.
So I ended up adding additional NIC with public IP address to the VM and use NSG to only allow traffic from Azure DevOps pipeline.
EDIT: Created a feedback item, please vote if you need this functionality as well: https://feedback.azure.com/forums/217313-networking/suggestions/36482038-add-application-gateway-support-for-azure-devops-t

Is it possible to retrieve the oms workspace id inside my ARM template

I create an oms workspace through ARM templates and deploy them to azure through azure devops.
Because I have an automated mindset I also deploy the virtual machine ARM through azure devops.
Because I don't want to deploy the OMS workspace and go to the portal and copy the workspace id to paste this in the arm template parameters of the virtual machine to point the VM extension to the right workspace.
My question now is if it is possible to connect these 2 in 1 deployment to deploy an oms workspace and export the workspace id to the vm arm deployment.
So that I skip the manual step and automate the entire deployment.
Source: I found a fellow automate thinking guy but there was no right answer on his question.
https://github.com/MicrosoftDocs/azure-docs/issues/13787
Does anyone have any clue if this is possible I searched and not found any way to do this atm.
you can use reference() function to achieve that:
"[reference(resourceId('Microsoft.OperationalInsights/workspaces', 'workspaceName'), '2017-03-15-preview').customerId]"
https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions-resource#reference

Azure - backup app on vm before delivering new changes

I have several .NET applications that are hosted In Azure on virtual machines IIS. I want to automate deployment process directly from my machine or visual studio without using Azure portal because we are doing several deliveries each day. The biggest challenge for me now is to do backup before deployment. So I need to backup specific folder on VM remotely. Could anyone tell me how I can do it?
Are there any best practices for automation delivery from visual studio to Azure VM? Backup of app is required.
First, I'm assuming that you would like to back up some specific folders in your VM to an Azure Blobs or Azure Files storage. There are two parts you'd need to complete your continuous deployment:
Automate backing up some folders in your virtual machine.
Integrate task #1 into a CICD (Continuous Integration Continuous Deployment) tool, which I'd suggest VSTS (Visual Studio Team Services) for your beginning.
Approach #1
You can expose Windows Remote Management (WinRM) endpoint publicly and use PowerShell to perform a folder backup task. You will also need to invoke some scripts to write/copy your backup to Azure Blobs Storage. Your script must be authenticated silently so you don't need to key in Azure subscription admin or VM admin.
Once you have a PowerShell script, you can invoke this PowerShell by creating a new PowerShell task in your Build or Release definition. I'd suggest to define in Release definition.
Approach #2
It's more Cloud native and you don't have to expose WMI of your virtual machine which would lead to security threat. Instead, you utilize Azure Automation Worker to automate the entirely backup & copy to another Azure services (Blobs, Files, another backup/file server virtual machine..). In your run book, you need to use PowerShell DSC (Desired State Configuration) to interact with resources inside your virtual machine.
In VSTS, you have two ways to start your runbook
Invoke runbook's webhook: you can create a webhook for your runbook and call this webhook by creating a Http Task
Start runbook by PowerShell: similar to the approach #1, just create PowerShell task then use Start-AzureAutomationRunbook cmdlet with sample here.
Build an ARM template for your Runbook then define in Build definition. Here is the sample reference to deploy an ARM template in VSTS,
The reason I have to give several references because you might not have familiarity with CICD and DevOps concept, as well as some useful tools in Azure and VSTS which supports your continuous deployment. There are some awesome CICD solutions in the market you should also explore, such as Chef, Ansible, Puppet. They support CICD very well. Below are some references to get started with DevOps on Azure:
https://learn.microsoft.com/en-us/vsts/deploy-azure/
https://learn.microsoft.com/en-us/azure/automation/automation-dsc-overview
https://learn.microsoft.com/en-us/vsts/build-release/apps/cd/azure/azure-devops-project-aspnetcore

Resources