Archive for the ‘Azure’ Category

How to: Resize virtual machines in #Azure With #Powershell Multiple or Single virtual machines

With the new VM sizes in Azure you may want to change the Size as you get more VM for less money. but remember the VM will restart! so better fi


But changing the VM by hand is a time consuming  job So Powershell could be very handy in this case. you can change the Vm size easily with a one-liner

So first we need to login into the azure Subscription.


If you have multiple Subscriptions you need to select the right subscription.

$subscrip=Get-AzureRmSubscription | Out-GridView -OutputMode Single -Title ‘Please select a Azure Subscription.’
Select-AzureRmSubscription -TenantId  $subscrip.TenantId




$vm = Get-AzureRmVM -VMName MVPCB10 -ResourceGroupName RSG-VNET
$vm.HardwareProfile.VmSize = "Standard_D2_v3"
Update-AzureRmVM -VM $vm -ResourceGroupName RSG-VNET

Ok this seems nice but I have 50 VM’s that I like to change

#set new Size to VM
1..5 | % {
$vm = Get-AzureRmVM -ResourceGroupName RSG-VNET -VMName MVPCB1$_
$vm.HardwareProfile.VmSize = "Standard_D13_v2_Promo"
Update-AzureRmVM -VM $vm -ResourceGroupName RSG-VNET


Better But if you used random names then the above will not really help you in quick size changing. The next step would be selecting all the VM that needs to be changed and selecting a Size for changing. That sounds great but how to start ?

With the Out-GridView you can do great things. to bad that the price is not available in this.



The script would be like this :


$VMList = Get-AzureRmVm | Out-GridView -OutputMode Multiple -Title ‘Please select an Azure Virtual Machine to resize.’;
$TargetSize = Get-AzureRmVmSize -Location westeurope | Out-GridView -OutputMode Single -Title ‘Please select a target Azure Virtual Machine size.’;
foreach ($VM in $VMList) {
  Write-output "Resizing Microsoft Azure Virtual Machine" $VM.Name "in Resource Group" $VM.ResourceGroupName "to size" $TargetSize
  Update-AzureRmVm -VM $VM -ResourceGroupName $VM.ResourceGroupName -Verbose

After this the VM’s are all changed in a other Size.

Follow Me on Twitter @ClusterMVP

Follow My blog

Linkedin Profile Http://

Google Me :

Bing Me :


Posted July 18, 2017 by Robert Smit in Azure

Tagged with

Azure Backup building backup vaults Protect On-premises workloads for Azure VM in Azure #azure #marsa #mars

The usage of cloud is often a pain what application or server should we move to the cloud just to get the feeling. And what about backup where to store the files. Well you could move your backup to the cloud and see how this is treating you. If you have storsimple or SCDPM than you can use also the backup vaults.  or save the azure backup on premise. Or simple create a backup vault.

The big difference between backup Protect On-premises workloads and Protect Azure Virtual Machines is simple in the Protect Azure Virtual Machines there is a full copy of the machine and no file selection. If you want file selection backup in Azure virtual machines you will need Protect On-premises workloads.

Funny Protect On-premises workloads for Azure Virtual machines running in Azure


all you need is an agent and a Azure Subscription go to

Setting up backup for Azure virtual machines can be achieved in three simple steps:

  1. Discover the machines that can be protected in the Azure Backup vault.
  2. Register the discovered virtual machines to Azure Backup vault.
  3. Protect the registered virtual machines by associating them with a policy defining backup schedule and how long you want to retain.

First we need a backup Vault keep in mind that the region of your azure VM’s must be the same as you backup vault. when you do a on premise backup there is no need for this.



In this section you can create a site recovery vault backup or a backup vault.  More info about and how to setup a recovery vault Azure Site Recovery Service #ASR #Hyper-v to #Azure #Recovery


Now that the vault is created you have two options what to backup Protect On-premises workloads or Protect Azure Virtual Machines



The Protect On-premises workloads is easy to setup First we need the vault credentials that are needed for the secure communication between on premise and azure


We save this file on the protected machine or on a file share.

And we need to download an agent and install this on every machine that we want to backup. No there is no Management suite to manage all this.

image image

Installing the Agent and registering the Vault credentials.


image Generate a passphrase or use your own but in case of a lost passphrase your backup is gone.


If the passphrase is lost or forgotten; Microsoft cannot help in recovering the backup data. The end user owns the encryption passphrase and Microsoft does not have any visibility into the passphrase which is used by the end user. Please save the file in a secure location as it would be required during a recovery operation.

When checking Azure you can see Windows Server and Azure VM to protect.




the backup tool to select files and folders to backup.



Protect Azure Virtual Machines



First we need to register items to the vault to protect. this will run a quick discovery of all your VM’s in the Region / subscription

To make sure that all items are discovered we run discover first


Successfully discovered virtual machines in the region West Europe. Please register the virtual machines to a vault of same region.

Now we are ready to register some machines to backup


I want to backup my mvpdummy01 machine


Check Protect and pick the machine and this machine is now registered


next step is to protect this VM again select the machine and your done.


Now that the machine is registered and protected we can us a default or create a custom protection level. the max setting is 99 years. why not 100 ? Guess this is not a time machine but only a backup vault that you can restore a windows server 2003 in year 2114




Storage replication

The Locally Redundant option maintains 3 copies of your data within the same region.
The Geo-Redundant option maintains 3 copies of your data locally and 3 copies in a secondary storage region.

The storage replication choice cannot be changed once items have been registered to the vault. Learn More



Nice and easy backup

Happy Clustering


Robert Smit

Posted September 28, 2015 by Robert Smit in Azure

Tagged with

PowerShell Place custom VM into Windows Azure Pack Subscription #wapack #cloud #scvmm #Microsoft

During migrations there is always the trouble of all those settings and things to do before everything is running smoothly.

Well during my migration I needed to move several Machines to a private cloud subscription in Azure Pack.

As I’m not the Biggest Powershell Guru I like to keep things simple and I’m a big fan of the “ select Name “  and the  “ Out-GridView “

Options these options give you much more detail and make powershell a but more GUI ( don’t shoot )

#Set your SCVMM server and use -ForOnBehalfOf to make use of Service Provider Foundation.
Import-Module -Name virtualmachinemanager
$VMMSERVER = Get-SCVMMServer -ComputerName YOUR OWN VMM Server-ForOnBehalfOf

#Select WAP Cloud
$Cloud = Get-SCCloud -Name (Get-SCCloud | select Name | Out-GridView -Title "Select WAP Cloud" -PassThru).Name

#Select Select WAP User Subscription
$User = (Get-SCUserRole | Where-Object Cloud -Match $Cloud).Name | Out-GridView -PassThru -Title "Select WAP User Subscription"

# Show WAP Subscription User
$WAPUserrole = Get-SCUserRole | Where-Object Cloud -Match $Cloud | Where-Object Name -Like $User*
$WAPUserrole |ft name

# Select Single VM to WAP
$WAPVM = (Get-SCVirtualMachine ($Cloud | Get-SCVirtualMachine | select Name | Out-GridView -Title "Select Single VM to WAP" -PassThru).Name)



# show Selected VM to WAP Subscription
$WAPVM|ft name

#Place VM in WAP Subscription
Set-SCVirtualMachine -VM $WAPVM –UserRole $WAPUserrole –Owner $User

As there is a pick list there is no typo there when moving the VM

When Checking the Windows Azure Portal you will see after a refresh a VM that is migrated to Azure Pack.



Happy clustering

Robert Smit


Posted April 14, 2015 by Robert Smit in Azure

Tagged with ,

  • Tag