Skip to content

Commit 78b764f

Browse files
committed
VMSS Gallery Item
Tool to add VM Scale Set gallery item to Azure Stack
1 parent 7f0bb98 commit 78b764f

3 files changed

Lines changed: 65 additions & 2 deletions

File tree

ComputeAdmin/AzureStack.ComputeAdmin.psm1

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,42 @@
33

44
#requires -Modules AzureStack.Connect
55

6+
function Add-AzureStackVMSSGalleryItem {
7+
8+
$rgName = "vmss.gallery"
9+
10+
New-AzureRmResourceGroup -Name $rgName -Location local -Force
11+
12+
$saName = "vmssgallery"
13+
14+
$sa = New-AzureRmStorageAccount -ResourceGroupName $rgName -Location local -Name $saName -Type Standard_LRS
15+
16+
$cName = "gallery"
17+
18+
Set-AzureRmCurrentStorageAccount -StorageAccountName $saName -ResourceGroupName $rgName
19+
20+
$container = Get-AzureStorageContainer -Name $cName -ErrorAction SilentlyContinue
21+
if (-not ($container)) {
22+
New-AzureStorageContainer -Name $cName -Permission Blob
23+
}
24+
25+
$fileName = "microsoft.vmss.1.3.6.azpkg"
26+
27+
$blob = $container| Set-AzureStorageBlobContent –File ([System.IO.Path]::GetDirectoryName($PSCommandPath) + "\" + $fileName) –Blob $fileName -Force
28+
29+
$uri = $blob.Context.BlobEndPoint + $container.Name + "/" + $blob.Name
30+
31+
Add-AzureRMGalleryItem -GalleryItemUri $uri
32+
}
33+
34+
function Remove-AzureStackVMSSGalleryItem {
35+
$item = Get-AzureRMGalleryItem -Name "microsoft.vmss.1.3.6"
36+
if($item) {
37+
$request = $item | Remove-AzureRMGalleryItem
38+
$item
39+
}
40+
}
41+
642
<#
743
.SYNOPSIS
844
Contains 6 functions.

ComputeAdmin/README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,36 @@ $path = "<Path to vm extension zip>"
9494
Add-VMExtension -publisher $publisher -version $version -extensionLocalPath $path -osType Windows -tenantID $aadTenant -azureStackCredentials $azureStackCredentials -type "CustomVmExtension"
9595
```
9696

97-
# Remove a VM extension with PowerShell
97+
## Remove a VM extension with PowerShell
9898
Run the below command to remove an uploaded VM extension.
9999

100100
```powershell
101101
Remove-VMExtension -publisher $publisher -version $version -osType Windows -tenantID $tenantId -azureStackCredentials $azureStackCredentials -type "CustomVmExtension"
102-
```
102+
```
103+
104+
## Add VM scale set gallery item
105+
106+
VM Scale Set allows deployment of multi-VM collections. To add a gallery item with VM Scale Set:
107+
108+
1. Add evaluation Windows Server 2016 image using New-Server2016VMImage as described above.
109+
110+
2. For linux support, download Ubuntu Server 16.04 and add it using Add-VmImage with the following parameters -publisher "Canonical" -offer "UbuntuServer" -sku "16.04-LTS"
111+
112+
3. Add VM Scale Set gallery item as follows
113+
114+
```powershell
115+
$Tenant = "<AAD Tenant Id used to connect to sazure stack>"
116+
$Arm = "<AzureStack administrative Azure Resource Manager endpoint URL>"
117+
118+
Add-AzureStackAzureRmEnvironment -Name AzureStackAdmin -ArmEndpoint $Arm -AadTenant $Tenant
119+
120+
$Password = ConvertTo-SecureString -AsPlainText -Force "<your AzureStack admin user password>"
121+
$User = "<your AzureStack admin user name>"
122+
$Creds = New-Object System.Management.Automation.PSCredential $User, $Password
123+
124+
Login-AzureRmAccount -EnvironmentName AzureStackAdmin -Credential $Creds -TenantId $Tenant
125+
126+
Select-AzureRmSubscription -SubscriptionName "Default Provider Subscription"
127+
128+
Add-AzureStackVMSSGalleryItem
129+
```
127 KB
Binary file not shown.

0 commit comments

Comments
 (0)