This file contains hidden or 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
| class Person { | |
| [ValidateNotNullOrEmpty()] | |
| [string] $FirstName; | |
| [ValidateNotNullOrEmpty()] | |
| [string] $LastName; | |
| [string] $Address; | |
| Person([string] $First, [string] $Last) { | |
| $this.FirstName = $First; |
This file contains hidden or 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
| function Wait-AzureVMDscConfiguration { | |
| <# | |
| .Synopsis | |
| Waits for a DSC configuration to complete on an Azure Virtual Machine. | |
| .Parameter ServiceName | |
| The name of the Azure Cloud Service containing the Virtual Machine. | |
| .Parameter Name | |
| The name of the Azure Virtual Machine inside the Cloud Service container. |
This file contains hidden or 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
| <# | |
| .Author | |
| Trevor Sullivan <pcgeek86@gmail.com> | |
| .Links | |
| http://trevorsullivan.net | |
| http://twitter.com/pcgeek86 | |
| .Description | |
| This PowerShell script uses the Microsoft Azure PowerShell module along with PowerShell |
This file contains hidden or 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
| <# | |
| Author: Trevor Sullivan | |
| Date: 2015-03-29 | |
| Description: Microsoft Azure Disk objects offer the full URL to the cloud-based VHD | |
| however, the Storage Account name is not exposed independently. We can | |
| use PowerShell's Add-Member command to parse the URL and offer up the | |
| Storage Account as its own property on each Disk object. | |
| #> | |
| Select-AzureSubscription -SubscriptionName 'Visual Studio Ultimate with MSDN'; |
This file contains hidden or 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
| ### Find the required properties for a particular DSC resource | |
| (Get-DscResource | Out-GridView -PassThru).Properties; |
This file contains hidden or 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
| function azrdp { | |
| <# | |
| .Author | |
| Trevor Sullivan <pcgeek86@gmail.com> | |
| .Description | |
| Invoke a RDP session to an Azure Virtual Machine, without having to type the | |
| Cloud Service name or Virtual Machine name. | |
| .Outputs |
This file contains hidden or 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
| $VMList = Get-AzureVM; | |
| foreach ($VM in $VMList) { | |
| Start-Job -ScriptBlock { | |
| Write-Output -Message ('Stopping VM {0} {1}' -f $args[0].ServiceName, $args[0].Name); | |
| Stop-AzureVM -ServiceName $args[0].ServiceName -Name $args[0].Name -Force; | |
| } -ArgumentList $VM; | |
| } |
This file contains hidden or 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
| function Enter-AzurePSSession { | |
| [CmdletBinding()] | |
| param ( | |
| [Parameter(Mandatory = $true)] | |
| [string] $ServiceName, | |
| [Parameter(Mandatory = $true)] | |
| [string] $VMName | |
| ) | |
| $SessionOption = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck; | |
| $WinRMUri = Get-AzureWinRMUri -ServiceName $ServiceName -Name $VMName; |
This file contains hidden or 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
| # Authenticate to Microsoft Azure and import subscription details | |
| $Username = 'trevor@trevorsullivan.net'; | |
| $GetCredential = @{ | |
| Username = $Username; | |
| Message = 'Please enter your Microsoft Azure password.'; | |
| } | |
| $AzureCredential = Get-Credential @GetCredential; | |
| Add-AzureAccount -Credential $AzureCredential; | |
| # Select the appropriate Microsoft Azure subscription |
This file contains hidden or 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
| $ParameterList = @(); | |
| # Get a list of PowerShell commands | |
| $CommandList = Get-Command -CommandType Cmdlet,Function -Module Azure; | |
| foreach ($Command in $CommandList) { | |
| foreach ($ParameterSet in $Command.ParameterSets) { | |
| foreach ($Parameter in $ParameterSet.Parameters) { | |
| $ParameterList += [PSCustomObject]@{ | |
| Module = $Command.ModuleName; |