Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PowerShell commands for Azure install. #211

Open
siennathesane opened this issue Sep 26, 2017 · 0 comments
Open

Add PowerShell commands for Azure install. #211

siennathesane opened this issue Sep 26, 2017 · 0 comments

Comments

@siennathesane
Copy link
Contributor

siennathesane commented Sep 26, 2017

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."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant