Created
February 13, 2015 16:15
-
-
Save stuartpreston/195c87699618b5884861 to your computer and use it in GitHub Desktop.
[Powershell] Demonstrates how to create a Windows VM in Azure, adding the Chef-Client VM Extension and automatically registering the node with an accessible Chef 12 Server.
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
[CmdletBinding()] | |
param( | |
[string] $PublishSettingsFile = "pendrica-credentials.publishsettings", | |
[string] $ChefServerUrl = "https://chef.pendrica.com/organizations/azure-env-dev", | |
[string] $ChefValidationKey = ".chef\azure-env-dev-validator.pem", | |
[string] $ChefValidationClientName = "azure-env-dev-validator", | |
[string] $AzureSubscriptionName = "Microsoft Partner Network", | |
[string] $AzureImageName = "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-Technical-Preview-201410.01-en.us-127GB.vhd", | |
[string] $AzureInstanceSize = "Standard_D1", | |
[string] $AzureLocation = "North Europe", | |
[string] $AzureStorageAccountName = "pendricastore01", | |
[string] $AzureCloudServiceName = "pendricacloud01", | |
[string] $AzureVirtualMachineName = "pendev01app01", | |
[string] $NodeAdminUsername = "localadmin", | |
[string] $NodeAdminPassword = "P2ssword" | |
) | |
Import-Module Azure | |
Import-AzurePublishSettingsFile -PublishSettingsFile $PSScriptRoot\$PublishSettingsFile | |
Select-AzureSubscription -SubscriptionName $AzureSubscriptionName | |
Set-AzureSubscription -SubscriptionName $AzureSubscriptionName -CurrentStorageAccount $AzureStorageAccountName | |
New-AzureQuickVM -Windows -ServiceName $AzureCloudServiceName -Name $AzureVirtualMachineName -ImageName $AzureImageName ` | |
-AdminUsername $NodeAdminUsername -Password $NodeAdminPassword -Location $AzureLocation -InstanceSize $AzureInstanceSize | |
Get-AzureVM -ServiceName $AzureCloudServiceName -Name $AzureVirtualMachineName | ` | |
Set-AzureVMChefExtension -Windows -AutoUpdateChefClient -ValidationPem $PSScriptRoot\$ChefValidationKey ` | |
-ChefServerUrl $ChefServerUrl -ValidationClientName $ChefValidationClientName | Update-AzureVM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment