Skip to content

Instantly share code, notes, and snippets.

@BrandonBoone
Last active January 26, 2018 18:30
Show Gist options
  • Save BrandonBoone/4539261cd5745e9767a6df271cb8e0dc to your computer and use it in GitHub Desktop.
Save BrandonBoone/4539261cd5745e9767a6df271cb8e0dc to your computer and use it in GitHub Desktop.
Powershell Script to deploy RabbitMQ to Azure Container Group
# Must run Login-AzureRmAccount first
Import-Module AzureRM
$resourceGroup = "dockerTest-$(Get-Random)"
$registryName = "myContainerRegistry$(Get-Random)"
$instanceName = "rabbit-$(Get-Random)"
$location = "EastUS"
New-AzureRmResourceGroup -Name $resourceGroup -Location $location
$registry = New-AzureRMContainerRegistry -ResourceGroupName $resourceGroup -Name $registryName -EnableAdminUser -Sku "Basic"
$creds = Get-AzureRmContainerRegistryCredential -Registry $registry
$serverTag = "$($registry.LoginServer)/rabbitmq:v1"
docker login $registry.LoginServer -u $creds.Username -p $creds.Password
docker pull rabbitmq
docker tag "rabbitmq:3-management" $serverTag
docker push $serverTag
$secpasswd = ConvertTo-SecureString $creds.Password -AsPlainText -Force
$mycred = New-Object System.Management.Automation.PSCredential ($registryName, $secpasswd)
New-AzureRmContainerGroup -ResourceGroupName $resourceGroup `
-Name $instanceName `
-Image $serverTag `
-IpAddressType "public" `
-Port @(15672, 5672, 80) `
-EnvironmentVariable @{"RABBITMQ_DEFAULT_USER"="guest";"RABBITMQ_DEFAULT_PASS"="guest"} `
-RegistryCredential $mycred
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment