Is it possible to have the vm's in a VMSS be in a deployment group inside of VSTS?
Could I provision a vm with the deployment group, save its disk image, and use that as the image for the vm's in the scale set? That way when a new VM is created it will already have the vsts agent on it. But, will the authentication still work against VSTS? I know it uses a PAT, I feel like there could be issues there.
Also, if new vm's "scale" up, how would they be able to get the latest version of the build? Would I have to run the Release inside of VSTS everytime the scale set scales up?
Related
As a beginner of DevOps, I would like to know how to use one VM for azure pipeline runs. When starting the run of the azure pipeline task it always gives a fresh VM from azure.
For caching and file saving purposes, I want to use a reserved VM for pipeline run.
Appreciate your suggestions and support.
Check the pic, In the Azure DevOps, we could run the pipeline via Hosted agent and Self-Host agent.
Azure Pipelines provides a pre-defined agent pool named Azure Pipelines, this is hosted agent and each time you run a pipeline, you get a fresh virtual machine. The virtual machine is discarded after one use.
For caching and file saving purposes, I want to use a reserved VM for pipeline run.
We could refer to this doc to install the self-hosted agent, it will save the cache.
You can setup a 'self hosted agent'. That would be your own VM, which you have total control over. I'm not sure whether this will be any cheaper than hosted agents.
I've used a self-hosted agent a while ago, and saved some money booting the VM only when needed. After a while it would shutdown again.
Source: Self-hosted agents
I am learning VMSS and have two general questions for my understanding.
Q1 : How new virtual machines gets provisioned in the VMSS?
Does it clone the existing VM from VMSS or use Image every time to provision a new VM?
. If it clone existing VM from VMSS then which VM out of the existing VM’s it clone?
. If it provision new VM from the image then in the case of platform image, do I need to install web server and other changes every time because I do not have a requirement to use a custom image?
How to make changes to the VM’s in VMSS?
. If I need to modify web server settings then how do I make the same settings on the other VM’s in VMSS?
Q1: How new virtual machines get provisioned in the VMSS?
It creates the new VM from the configuration that you set for the VMSS every time, not clone the existing VMs. If you do not use the custom image, then you need to install web server and other changes every time for the new VMs.
Q2: How to make changes to the VM’s in VMSS?
You can use the VM extension to make the changes to the VMs in the VMSS. Or just use the custom image.
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.
I have created a Azure Scale Set upto 3 Linux VMs using the Azure Portal. I have successfully installed java, maven and git on the first VM. I was able to run my App on the first VM.
I have a fan out trigger at 60% and fan in at 25%. Whenever my processing exceeds 60% a new VM is started.
But how do I deploy my app on the second VM? I have gone through this and found the second option custom VM image suitable for my purpose. But I fail to understand how it is achieved.
Is there a easier way or do I have to manually install everything that I did on my first VM?
You have several options available to do this, detailed here
From a single image that you keep refreshing each time you update the app or the os
using a VM Extension - refresh the extension url each time you want to update the vms, and then issue a ps or rest command to roll out the updates
use something like puppet/chef/dsc to pull updates from somewhere and install them - you could use msdeploy for example
use msdeploy from a script that iterates your vms and remote deploys.
I'm sure there are other ways too...
To do this, you will need to create a generalized VM image, put it into a storage account, then create a scale set based on that image.
Here are instructions for creating a generalized Windows VM image, see here: https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-classic-createportal/
For Linux, see here: https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-upload-vhd/
Once the image is in a storage account, you can use this example template to deploy it in a scale set (assumes Windows image): https://github.com/Azure/azure-quickstart-templates/tree/master/201-vmss-windows-customimage
Hope this helps! :)
I have a cloud service project with deployment settings
"Delete deplyment on failure" - unchecked
"Deployment update" - checked
"If deployment can't be updated, do a full deployment" - unchecked
When I deploy a new version it seems the virtual machine is always intact and it just creates a new disk with my code which it attaches as either E: or F:.
Will a deployment ever create a new vm or will it always use the existing vm. Will new VMs only be created when the VM template is updated?
From our experience, Cloud Services Updates will always use the current deployed instances, they won't create new ones, unless you are modifying the amount or size of instances: Taken from here
You might want to consider having a Staging / Production pair of environments and doing a Swap.
When we used Cloud Services, our Staging environment was always empty, we deployed there, then swapped and then deleted the Staging (former Production) deployment.