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! :)
Related
I want to create a baseline copy of Azure VM, Install all SQL and some 3rd party software I needed to it and create a copy / backup of it locally.
This copy / backup can be re-deployed again to a new VM for a new client.
currently I'm spending 1 to 2 days setting up this VM, installing and configuring this server.
How do I do it ?
Use any configuration management tools Ansible, Puppet, Chef...
Docker is the simplest thing I can think of. Upload your own image to a registry and then spawn as many VMs using it as you want.
See this for some pointers: Deploy image from Azure Container Registry to an Azure Linux Virtual Machine
Ansible and other CM tools will give you more functionality for more effort.
I am trying to better understand azure virtual machine scale sets and how my company can use it. Currently we run a custom software (wpf program) that will need to be deployed and updated on all VMs.
Is a extension where I setup the deploy of the wpf?
Can I pull the files from a git repo to deploy?
How do I config this?
Not directly. there is a custom script extension and azure powershell dsc extension (and several others, like chef) which allow you to do pretty much anything, but nothing built-in
No, you cannot do that natively, you can use those extensions to do whatever you like. Or, better, you can use ci\cd systems (like Azure Devops) to do that. You need to install agent on the vm (in most cases) and then use that ci\cd system to deploy to vmss instances.
Another alternative - using images, that is a native way, but you need to prebuild images (packer, questionmark).
I need to start / stop a Azure virtual machine, but I don't know how I can do this. I don't know anything about Azure or Azure scripts.
You have several options.
The first one is by using the Azure Portal. Click on your VM and at the bottom you should see a button to stop the virtual machine. Starting it again works the same way.
The second option is to use PowerShell. John McCabe has posted a simple script on his blog to do this. The most important functions are Start-AzureVM and Stop-AzureVM.
If you want to automate this from a developer perspective (which needs a little bit more work than the PowerShell solution) is by using the Azure Management Libraries. Brady Gaster wrote a great post about it.
The fourth option is to use Microsoft Azure Automation. There you create runbooks for common tasks. In the samples are scripts already included which can start and stop a VM.
You can also create a Timer-triggered Azure Function to start/stop your VM. I've provided the steps here:
Azure Function role like permissions to Stop Azure Virtual Machines
Instead of creating HTTP-triggered Functions, just use Timer-triggered functions instead and edit the PowerShell script content to hardcode the vmname and resourcegroup.
within the Azure portal (I would recommend using the new portal), go into the VM you need, on the dashboard you will see a Stop and Start button, or you can choose to Restart the VM. Hope this helps.
I have two Azure VM's running in a cloud service. They contains almost the same thing. Some TCP port's are also opened between them.
Is it possible to create a deploy package from this existing setup so that at a later time can deploy this setup in an easy way. I.e. I want to be able to do this:
1. Create deploy package from existing setup *
2. Delete whole existing cloud service including VM's
3. Deploy the package from step 1 and have everything created again.
*I can save one of the VM's to my Azure storage and use it as template for both of them if that is easier.
How to accomplish this if it is possible?
Yes, you can take what you have as a template and use it to stand up multiple silos. But in IaaS, there isn't a notion of a deployment package. There's a few things you'll need to do...
1) understand how to take an existing VM and turn it into an image
2) use Powershell or another DevOps style automation suite (Chef/Puppet/etc..) to define deploy your silo.
You seem specifically interested in how to create an image so I'd recommend using the tutorial we have published on this. http://www.windowsazure.com/en-us/documentation/articles/virtual-machines-capture-image-windows-server/ This does of course presume you're running Windows Server. But a Linux version it can be found at: http://www.windowsazure.com/en-us/documentation/articles/virtual-machines-linux-capture-image/
The automation of a deployment depends on a great many things, so I'd suggest at a starting point, familiarizing yourself with the management API: http://msdn.microsoft.com/en-us/library/windowsazure/ee460799.aspx
With the implementation of Resource Manager, you can now easily use JSON template to deploy and redeploy resources in Azure. There are also starter templates available - https://azure.microsoft.com/en-us/documentation/templates/
I have an existing VM with a configured Sharepoint environment. I would like to use this machine as a base for creating multiple azure VM instances for several developers to work on. Is such scenario possible? Is running 'sysprep' (will ruin my sharepoint) unevitable?
I would also be able to upgrade the 'image' (e.g. install windows updates) and create VM's from it afterwards.
How can I achieve this? I know cloudshare offers similar solution, so I suppose it also can be done in azure.
You certainly can make an image from a Virtual Machine. The entire process is described here. Also look at my other SO answer about a caveat when running sysprep (regarding not letting the VM image shut down after sysprep runs).
Once you have your image, it will be available in your Virtual Machine gallery, where you can choose it as your baseline for new VMs (either via portal or PowerShell / CLI).
If, in the future, you do updates on your master image, you'd need to re-create an image for future deployments. Or... you'd need to install the updates on each deployed VM instance.
Note: With web/worker role instances (which doesn't help for SharePoint but could help with other workloads you have), the Windows Server OS image is maintained by Microsoft. Should there be an OS update, these are taken care of for you.