Last active
May 23, 2017 19:28
-
-
Save tylerd/79b13574dad168e83a363b3c6aa78640 to your computer and use it in GitHub Desktop.
AzureUnmanagedDiskScripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$subscriptionName = "IAAS"; | |
$storageAccountName = "demop2svpndisks"; | |
$storageAccountResourceGroupName = "Demo2"; | |
$containerName = "vhds"; | |
$blobName = "Jumpbox34.vhd"; | |
Login-AzureRmAccount | |
Select-AzureRmSubscription -SubscriptionName $subscriptionName | |
$sa = Get-AzureRmStorageAccount -ResourceGroupName $storageAccountResourceGroupName -Name $storageAccountName | |
$key = (Get-AzureRmStorageAccountKey -ResourceGroupName $storageAccountResourceGroupName -Name $storageAccountName)[0].Value | |
$ctx = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $key | |
$copy = Start-AzureStorageBlobCopy -SrcBlob $blobName -SrcContainer $containerName -DestContainer $containerName -DestBlob "$blobName-Copy1" -Context $ctx | |
$copy | Get-AzureStorageBlobCopyState -WaitForComplete |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$subscriptionName = "IAAS"; | |
$osDiskUri = "https://demop2svpndisks.blob.core.windows.net/vhds/Jumpbox34.vhd-Copy1" | |
$resourceGroupName = "NewVMResourceGroup" | |
$location = "canadacentral" | |
$existingVnetName = "" | |
$existingVnetResourceGroup = "" | |
$vmName = "" | |
Login-AzureRmAccount | |
Select-AzureRmSubscription -SubscriptionName $subscriptionName | |
$vm = New-AzureRmVMConfig -VMName $vmName -VMSize "Standard_A2" | |
$vnet = Get-AzureRmVirtualNetwork -ResourceGroupName $existingVnetResourceGroup -Name $existingVnetName | |
$nicName = $vmName + "-nic" | |
$nic = New-AzureRmNetworkInterface -Name $nicName -ResourceGroupName $resourceGroupName ` | |
-Location $location -SubnetId $vnet.Subnets[0].Id | |
$vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nic.Id | |
$osDiskName = $vmName + "-osDisk" | |
$vm = Set-AzureRmVMOSDisk -VM $vm -Name $osDiskName -VhdUri $osDiskUri -CreateOption attach -Windows | |
New-AzureRmVM -ResourceGroupName $resourceGroupName -Location $location -VM $vm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment