Azure Powershell

This was useful

http://michaelwasham.com/2012/06/08/automating-windows-azure-virtual-machines-with-powershell/

When I installed Powershell I think I downloaded a publishsettings file. I copied this to c:\Temp and renamed it without spaces. Then as per above I used:

Import-AzurePublishSettingsFile ‘c:\temp\<publishsettingsfilename.publishsettings>’

Everything then worked including:

Get-AzureSubscription

Get-AzureStorage

 

To store a script use notepad and change the file extension to .ps1

Error

File ps1 cannot be loaded because running scripts is disabled on this system

Solution

http://support.microsoft.com/kb/2411920

To resolve this issue, follow these steps:

  1. Run the Windows Azure Active Directory Module for Windows PowerShell as an admin. To do this, click Start, click All Programs, click Windows Azure Active Directory, right-click Windows Azure Active Directory Module for Windows PowerShell, and then click Run as administrator.
  2. Set the execution policy to Unrestricted. To do this, type the following cmdlet, and then press Enter:
    Set-ExecutionPolicy Unrestricted
  3. Run the Windows PowerShell cmdlets that you want.
  4. Set the execution policy to Restricted. To do this, type the following cmdlet, and then press Enter:

    Set-ExecutionPolicy Restricted

 

Alternatively

  1. Open mmc.exe
  2. Add snap-in for Group Policy – local computer
  3. Computer configuration
  4. Administrative templates
  5. Windows components
  6. Windows Powershell
  7. Turn on Script Execution
  8. Right-click Edit
  9. Enabled
  10. Execution policy bottom LHS = Allow Local Scripts and remote Signed Scripts

After finish disable it.

 

http://blog.whatsupduck.net/2010/09/issues-with-configuring-powershell.html

Advertisements

One Response to Azure Powershell

  1. Pingback: Azure Virtual Machines adding virtual hard disks VHD | Steve Shakespeare

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: