November 8, 2017
Posted by on
I recently started to play with Azure Deployments via Visual Studio Team Services. The idea is having a source control for my ARM templates and keep my projects nice and tidy in one place.
I saw James Bannan presented on IT/DEV 2017 conference and liked this approach. Unfortunately, it is not clearly documented, or maybe I just cannot find a proper information since I am not a developer.
Anyway, I integrated my Visual Studio 2017 with VSTS; that created a Git instance for me. From the VSTS portal I creted a new Project and tried to clone it to my VS2017. It miserably failed with Error 400.
Resolution: It turned out the clone process does not like spaces in project name :0 . fortunately there is a workaround I found here it describes a similar issue with cloning from tfs, but since the issue is actually on VS side it works for VSTS too. You basically need to cancel cloning in VS window and select “Clone Repository” from Project section. This will replace spaces in URL with %20 and in this case it finishes successfuly.
April 12, 2016
Posted by on
February 18, 2016
Posted by on
One of my Customers asked me to move some VMs from expensive Premium storage account to a cheaper Standard tier.
The infrastructure was built using Resource Mode and luckily we do not need to convert VHDs to OS disks (as it is required for Classic VMs).
1. I shutdown/deprovision VM (you do not need to delete it)
2. Copy VHD OS disk and data disk to the new storage account
3. Recreate VM at the new place using the following script:
select-azurermsubscription -SubscriptionName “My Subscription”
# to check subnet index use: Get-AzureRmVirtualNetwork -Name msps –ResourceGroupName $rgName | Select Subnets
$vnet=Get-AzureRmvirtualNetwork -Name $vnetName -ResourceGroupName $rgName
$vm=New-AzureRmVMConfig -VMName $name -VMSize Standard_D4
$vm | Set-AzureRmVMOSDisk -VhdUri https://*******.vhd –Name $name -CreateOption attach -Windows -Caching ReadWrite
$vm | Add-AzureRMVMDataDisk -Name “XXXX-data” -VhdUri https://*****-data01.vhd -LUN 0 -Caching ReadWrite -CreateOption Attach -DiskSizeinGB 1023
$nicName= $name + “_nic”
$pipName= $name + “_pip”
$pip=New-AzureRmPublicIpAddress -Name $pipName –ResourceGroupName $rgName-DomainNameLabel $domName -Location $locName -AllocationMethod Dynamic
$nic=New-AzureRmNetworkInterface -Name $nicName –ResourceGroupName $rgName-Location $locName -SubnetId $vnet.Subnets[$subnetIndex].Id -PublicIpAddressId $pip.Id -PrivateIpAddress $privIP
$vm=Add-AzureRmVMNetworkInterface -VM $vm -Id $nic.Id
New-AzureRMVM -ResourceGroupName Sharepoint -Location “East US” -VM $vm –Verbose
The machine is recreated and started
here are some useful links I used: https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-ps-create-preconfigure-windows-resource-manager-vms/
if you have a lot of numbered disks: http://sc.scomurr.com/arm-recreating-vm-off-existing-vhds/
Microsoft doc: https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-create-windows-powershell-resource-manager/