-
Notifications
You must be signed in to change notification settings - Fork 569
/
CreateImage.ps1
24 lines (19 loc) · 1006 Bytes
/
CreateImage.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Param(
[Parameter(Mandatory=$true)]
[String] $subscriptionId,
[Parameter(Mandatory=$true)]
[String] $storageAccountName,
[Parameter(Mandatory=$true)]
[String] $storageAccountKey,
[Parameter(Mandatory=$true)]
[String] $resourceGroupName
)
Login-AzureRMAccount
Select-AzureRmSubscription -SubscriptionId $subscriptionId
$cmd = 'azcopy /Source:https://airsimimage.blob.core.windows.net/airsimimage/AirsimImage.vhd /Dest:https://{0}.blob.core.windows.net/prereq/AirsimImage.vhd /destKey:{1}' -f $storageAccountName, $storageAccountKey
write-host $cmd
iex $cmd
$newBlobPath = 'https://{0}.blob.core.windows.net/prereq/AirsimImage.vhd' -f $storageAccountName
$imageConfig = New-AzureRmImageConfig -Location 'EastUs'
$imageConfig = Set-AzureRmImageOsDisk -Image $imageConfig -OsType Windows -OsState Generalized -BlobUri $newBlobPath
$image = New-AzureRmImage -ImageName 'AirsimImage' -ResourceGroupName $resourceGroupName -Image $imageConfig