iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) choco install WindowsAzurePowershellThe first command installs Chocolatey on the VM and the second one installs Azure PowerShell cmdlets. Now create a VM and add the script for remote execution. Save the script file locally. 2. From Azure Ibiza portal, browse to your VM and add Custom Script Extension by providing the saved script as input. 3. Once the script finishes execution, the script output can be viewed in the Extension blade of the UI. So as you can see the combination of Chocolatey and Custom Script Extension can automate many deployment scenarios. All of the above steps can be automated using Azure PowerShell cmdlets as described in a previous blog post.
Chocolatey with Custom Script Extension on Azure VMs
Közzétéve: november 25, 2014
This blog gives an overview of how to run Chocolatey commands on a remote Azure VM using Custom Script Extension. Chocolatey is a package manager for windows (similar to Yum/Apt-Get) used by Azure customers for installing packages. While there are many ways to automate this package installation, in this blog post we’ll do it using Custom Script Extension (CSE). Custom Script Extension for windows is a mechanism for running PowerShell scripts on a remote VM, without requiring to open any additional ports or manually downloading the scripts on the VM. As with any VM Extension, it can be added to a VM during VM provisioning or anytime while the VM running. The extension can be added from Azure Portal, PowerShell cmdlets and REST API and Azure Xplat CLI. Running Chocolatey cmdlets using CSE is actually pretty straightforward because Chocolatey commands can be already run from PowerShell. Lets look at the scenario of installing Azure PowerShell cmdlets on a remote VM using Chocolatey. 1. Create a .ps1 file with the following commands: