Skip to content

Add PowerShell commands for Azure install. #211

@siennathesane

Description

@siennathesane

It would be good if we had Azure PowerShell SDK commands for steps 1 and 2 of "Launching an Ops Manager Director Instance" under the Azure installation pages.

Here is a template script I wrote for the Azure Cloud Shell with the new PowerShell preview.

$StorageName = ""
$ResourceGroup = ""
$Location = ""
$SubscriptionName = ""
$OpsManURI = ""
# set global verbosity for all commands.
$PSDefaultParameterValues['*:Verbose'] = $true

Write-Host "Creating Resource Group and Storage Accounts"
New-AzureRmResourceGroup -Name $ResourceGroup -Location $Location
New-AzureRmStorageAccount -ResourceGroupName $ResourceGroup -AccountName $StorageName -Kind Storage -Type "Standard_LRS" -Location $Location

$Context = New-AzureStorageContext -StorageAccountName $StorageName -StorageAccountKey (Get-AzureRmStorageAccountKey -StorageAccountName $StorageName -ResourceGroupName $ResourceGroup).Value[0]

Write-Host "Creating storage containers."

$arr = @("vhds", "opsmanager", "bosh", "stemcell")

New-AzureStorageContainer -Name opsman-image -Permission Blob -Context $Context
for ($i = 0; $i -lt $arr.Length; $i++) { New-AzureStorageContainer -Name $arr[$i] -Context $Context }
New-AzureStorageTable -Name stemcells -Context $Context

Write-Host "Copying OpsMan blob."
Start-AzureStorageBlobCopy -AbsoluteUri $OpsManURI -DestContainer "opsman-image" -DestBlob "image.vhd" -DestContext $Context

while ((Get-AzureStorageBlobCopyState -Context $Context -Blob "image.vhd" -Container "opsman-image").Status -eq "Pending") { 
    Start-Sleep -Seconds 3
    Write-Host "Waiting on OpsMan Blob to finish copying" 
}

Write-Host "done."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions