forked from robotechredmond/Azure-PowerShell-Snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AzureRM - Select VM Image Publisher Offer Sku.ps1
67 lines (42 loc) · 1.57 KB
/
AzureRM - Select VM Image Publisher Offer Sku.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Sign-in with Azure account credentials
Login-AzureRmAccount
# Select Azure Subscription
$subscriptionId =
(Get-AzureRmSubscription |
Out-GridView `
-Title "Select an Azure Subscription ..." `
-PassThru).SubscriptionId
Select-AzureRmSubscription `
-SubscriptionId $subscriptionId
# If needed, register ARM core resource providers
Register-AzureRmResourceProvider `
-ProviderNamespace Microsoft.Compute
Register-AzureRmResourceProvider `
-ProviderNamespace Microsoft.Storage
Register-AzureRmResourceProvider `
-ProviderNamespace Microsoft.Network
Get-AzureRmResourceProvider |
Select-Object `
-Property ProviderNamespace `
-ExpandProperty ResourceTypes
# Set Azure Datacenter Region Location
$location =
"West US"
# Select VM Image Publisher
$vmImagePublisher =
( Get-AzureRmVMImagePublisher -Location $location ).PublisherName |
Out-GridView -Title "Select VM Image Publisher" -PassThru
# Select VM Image Offer
$vmImageOffer =
( Get-AzureRmVmImageOffer -Location $location -PublisherName $vmImagePublisher ).Offer |
Out-GridView -Title "Select VM Image Offer" -PassThru
# Select VM Image Sku
$vmImageSku =
( Get-AzureRmVmImageSku -Location $location -PublisherName $vmImagePublisher -Offer $vmImageOffer ).Skus |
Out-GridView -Title "Select VM Image Sku" -PassThru
# Set VM Image Version
$vmImageVersion = "latest"
# Get Azure VM Image information
$vmImage = Get-AzureRmVmImage -Location $location -PublisherName $vmImagePublisher -Offer $vmImageOffer -Skus $vmImageSku
$vmImage
$vmImage.Id