Created
March 4, 2013 05:42
-
-
Save wadewegner/5080199 to your computer and use it in GitHub Desktop.
PowerShell scripts supporting post "Using Windows Azure Virtual Machines to Publish and Synchronize a Web Farm" found here: http://www.wadewegner.com/2013/03/using-windows-azure-virtual-machines-to-publish-and-synchronize-a-web-farm/
This file contains 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
$imgname = 'WS2012-WebFarmImage' | |
$cloudsvc = 'DemoWebFarm' | |
$pass = 'Password' | |
$subscriptionName = 'Windows Azure MSDN - Visual Studio Ultimate' | |
$storageAccount = 'portalvhds9dvbvvff5hdg3' | |
$location = 'East US' | |
Set-AzureSubscription -SubscriptionName $subscriptionName -CurrentStorageAccount $storageAccount | |
$iisvm1 = New-AzureVMConfig -Name 'iis1' -InstanceSize Small -ImageName $imgname | | |
Add-AzureEndpoint -Name web -LocalPort 80 -PublicPort 80 -Protocol tcp -LBSetName web -ProbePath '/' -ProbeProtocol http -ProbePort 80 | | |
Add-AzureEndpoint -Name webdeploy -LocalPort 8080 -PublicPort 8080 -Protocol tcp | | |
Add-AzureProvisioningConfig -Windows -Password $pass | |
$iisvm2 = New-AzureVMConfig -Name 'iis2' -InstanceSize Small -ImageName $imgname | | |
Add-AzureEndpoint -Name web -LocalPort 80 -PublicPort 80 -Protocol tcp -LBSetName web -ProbePath '/' -ProbeProtocol http -ProbePort 80 | | |
Add-AzureProvisioningConfig -Windows -Password $pass | |
$iisvm3 = New-AzureVMConfig -Name 'iis3' -InstanceSize Small -ImageName $imgname | | |
Add-AzureEndpoint -Name web -LocalPort 80 -PublicPort 80 -Protocol tcp -LBSetName web -ProbePath '/' -ProbeProtocol http -ProbePort 80 | | |
Add-AzureProvisioningConfig -Windows -Password $pass | |
New-AzureVM -ServiceName $cloudsvc -VMs $iisvm1, $iisvm2, $iisvm3 -Location $location |
This file contains 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
$subscriptionName = 'Windows Azure MSDN - Visual Studio Ultimate' | |
$storageAccount = 'portalvhds9dvbvvff5hdg3' | |
$cloudsvc = 'DemoWebFarm' | |
$publishSettings = 'C:\Scripts\credentials.publishsettings' | |
Import-Module 'C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\Azure\Azure.psd1' | |
Import-AzurePublishSettingsFile $publishSettings | |
Set-AzureSubscription -SubscriptionName $subscriptionName -CurrentStorageAccount $storageAccount | |
$publishingServer = (gc env:computername).toLower() | |
Get-AzureVM -ServiceName $cloudsvc | foreach { | |
if ($_.Name.toLower() -ne $publishingServer) { | |
$target = $_.Name + ":8080" | |
$source = $publishingServer + ":8080" | |
$exe = "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" | |
[Array]$params = "-verb:sync", "-source:contentPath=C:\Inetpub\wwwroot,computerName=$source", "-dest:contentPath=C:\Inetpub\wwwroot,computerName=$target"; | |
& $exe $params; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment