Azure Powershell
17-Apr-1414 1 Comment
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:
- 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.
- Set the execution policy to Unrestricted. To do this, type the following cmdlet, and then press Enter:
Set-ExecutionPolicy Unrestricted
- Run the Windows PowerShell cmdlets that you want.
- Set the execution policy to Restricted. To do this, type the following cmdlet, and then press Enter:
Set-ExecutionPolicy Restricted
Alternatively
- Open mmc.exe
- Add snap-in for Group Policy – local computer
- Computer configuration
- Administrative templates
- Windows components
- Windows Powershell
- Turn on Script Execution
- Right-click Edit
- Enabled
- 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
Pingback: Azure Virtual Machines adding virtual hard disks VHD | Steve Shakespeare