This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resources | |
| where type =~ "Microsoft.Network/loadBalancers" | |
| mv-expand backendAddressPool=properties.backendAddressPools | |
| mv-expand ipconfig=backendAddressPool.properties.backendIPConfigurations | |
| extend ipconfig_id=tostring(ipconfig.id) | |
| project LB_name=name, ipconfig_id | |
| join ( | |
resources | |
| where type =~ "Microsoft.Network/networkInterfaces" | |
| mv-expand ipconfig=properties.ipConfigurations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Deploys a Virtual Machine Scale Set (with OS managed disk from an image) with an internal load balancer in front of it | |
#refer to this blog post for more information: https://wp.me/p9qR9L-5e | |
$Credential = Get-Credential | |
Add-AzureRmAccount -Credential $Credential | |
Select-AzureRmSubscription -SubscriptionId "Put your subscription ID here" | |
#This is your resource group in which your image, and all your other resources are located |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$vmssObject = Get-AzureRmVmss -ResourceGroupName $greenrg -VMScaleSetName $vmssName | |
$vmssObject.virtualMachineProfile.storageProfile.osDisk.image.uri= $newImageURI | |
$instances = Get-AzureRmVmssVM -VMScaleSetName $vmssName -ResourceGroupName $greenrg | |
foreach($instance in $instances){ | |
Update-AzureRmVmssInstance -ResourceGroupName $greenrg -VMScaleSetName $vmssName -InstanceId $instance.InstanceID | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-AzureRmAccount | |
Select-AzureRmSubscription -SubscriptionId "Put your Azure Subscription ID here" | |
$greenrg = "bluegreen" #Enter the name of your resource group here | |
$loc = "West Europe" #Enter the region of your choice here | |
$vnetname = "bgvnet" #Enter the virtual network name here | |
$backendSubnetName = "subnet1" #This is the name of your subnet in the virtual network | |
$LBFrontendNewPrivateIPAddress = "10.1.0.6" #This is the frontend IP Address of your internal load balancer. Make sure it is in the same range as your subnet | |
$stName = "bgvmss" #This is the storage account name (for the scale set) | |
$vmssName = 'esmaeilbgvmss'; #This has to be a unique name and needs to be changed with every redeployment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Login to Azure | |
Add-AzureRmAccount | |
#Select Azure Subscription | |
$subscription = | |
(Get-AzureRmSubscription | | |
Out-GridView ` | |
-Title 'Select an Azure Subscription ...' ` | |
-PassThru) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$azureCredential = Get-AutomationPSCredential -Name "AzMonkey" | |
if($azureCredential -ne $null) | |
{ | |
Write-Output "Attempting to authenticate as: [$($azureCredential.UserName)]" | |
} | |
else | |
{ | |
throw "No automation credential name was specified..." | |
} |