├── .gitattributes ├── .gitignore ├── .vscode └── settings.json ├── Aliases ├── Azure.Extensions.Aliases.json ├── Azure.Subscription.Aliases.json ├── AzureRm.AppService.Aliases.json ├── AzureRm.Profile.Aliases.json ├── AzureRm.ResourceManager.Aliases.json ├── AzureRm.SqlServer.Aliases.json ├── AzureRm.Storage.Aliases.json ├── AzureRm.VirtualMachine.Aliases.json └── README.MD ├── Azure-PowerShell-Extensions.sln ├── AzureExt.psd1 ├── AzureExt.psm1 ├── AzureExt.pssproj ├── Completers ├── Microsoft.Az.Automation.AutomationAccountName.ArgumentCompleters.ps1 ├── Microsoft.Az.Automation.RunbookName.ArgumentCompleters.ps1 ├── Microsoft.Az.CDN.ProfileName.ArgumentCompleters.ps1 ├── Microsoft.Az.ContainerGroup.Name.ArgumentCompleters copy.ps1 ├── Microsoft.Az.DNS.ZoneName.ArgumentCompleters.ps1 ├── Microsoft.Az.Locations.ArgumentCompleters.ps1 ├── Microsoft.Az.NetworkInterface.Name.ArgumentCompleters.ps1 ├── Microsoft.Az.RedisCache.Name.ArgumentCompleters.ps1 ├── Microsoft.Az.Resource.Name.ArgumentCompleters.ps1 ├── Microsoft.Az.ResourceGroup.ResourceGroupName.ArgumentCompleters.ps1 ├── Microsoft.Az.ResourceLocks.Name.ArgumentCompleters.ps1 ├── Microsoft.Az.Resources.ResourceId.ArgumentCompleters.ps1 ├── Microsoft.Az.Resources.ResourceType.ArgumentCompleters.ps1 ├── Microsoft.Az.SQL.CollationName.ArgumentCompleters.ps1 ├── Microsoft.Az.Storage.StorageAccountName.ArgumentCompleters.ps1 ├── Microsoft.Az.Subscription.SubscriptionName.ArgumentCompleters.ps1 ├── Microsoft.Az.VirtualMachine.VMName.ArgumentCompleters.ps1 ├── Microsoft.Az.VirtualNetwork.Name.ArgumentCompleters.ps1 ├── Microsoft.Azure.CloudService.ServiceName.ArgumentCompleters.ps1 ├── Microsoft.Azure.Storage.BlobName.ArgumentCompleters.ps1 ├── Microsoft.Azure.Storage.StorageAccountName.ArgumentCompleters.ps1 ├── Microsoft.Azure.Storage.StorageContainerName.ArgumentCompleters.ps1 ├── Microsoft.Azure.Subscription.SubscriptionName.ArgumentCompleters.ps1 ├── Microsoft.Azure.VirtualMachine.Name.ArgumentCompleters.ps1 └── README.MD ├── Format Types ├── Azure.PublicIP.format.ps1xml ├── Azure.ResourceGroup.format.ps1xml ├── Azure.StorageAccount.format.ps1xml └── Azure.VirtualMachine.format.ps1xml ├── Functions ├── Private │ └── Get-AllAzureLocations.ps1 └── Public │ ├── Invoke-AzureRemoteDesktop.ps1 │ ├── Invoke-AzureRmRemoteDesktop.ps1 │ ├── Publish-AzureStorageBlob.ps1 │ ├── Remove-AzureRmResourceGroupGui.ps1 │ ├── Remove-AzureRmResourceGui.ps1 │ ├── Resize-AzureRmVm.ps1 │ ├── Start-AzureRm.ps1 │ └── Unpublish-AzureStorageBlob.ps1 ├── Images └── README.md ├── LICENSE ├── Patch-ModuleManifest.ps1 ├── README.md ├── Snippets ├── arm-automation-create-account.snippets.ps1xml ├── arm-automation-import-runbook.snippets.ps1xml ├── arm-core-authenticate.snippets.ps1xml ├── arm-core-deploytemplate.snippets.ps1xml ├── arm-core-resourcegroup.snippets.ps1xml ├── arm-json-availabilityset.snippets.ps1xml ├── arm-json-documentdb.snippets.ps1xml ├── arm-json-networkinterface.snippets.ps1xml ├── arm-json-networksecuritygroup.snippets.ps1xml ├── arm-json-parameter.snippets.ps1xml ├── arm-json-publicipaddress.snippets.ps1xml ├── arm-json-rediscache.snippets.ps1xml ├── arm-json-storageaccount.snippets.ps1xml ├── arm-json-template.snippets.ps1xml ├── arm-json-variable.snippets.ps1xml └── arm-json-virtualnetwork.snippets.ps1xml ├── Tests ├── AzureExt.AutoCompletion.ManualTest.ps1 └── AzureExt.tests.ps1 ├── appveyor.yml └── en-us ├── README.md └── about_AzureExtensions.help.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | # DNX 42 | project.lock.json 43 | artifacts/ 44 | 45 | *_i.c 46 | *_p.c 47 | *_i.h 48 | *.ilk 49 | *.meta 50 | *.obj 51 | *.pch 52 | *.pdb 53 | *.pgc 54 | *.pgd 55 | *.rsp 56 | *.sbr 57 | *.tlb 58 | *.tli 59 | *.tlh 60 | *.tmp 61 | *.tmp_proj 62 | *.log 63 | *.vspscc 64 | *.vssscc 65 | .builds 66 | *.pidb 67 | *.svclog 68 | *.scc 69 | 70 | # Chutzpah Test files 71 | _Chutzpah* 72 | 73 | # Visual C++ cache files 74 | ipch/ 75 | *.aps 76 | *.ncb 77 | *.opensdf 78 | *.sdf 79 | *.cachefile 80 | 81 | # Visual Studio profiler 82 | *.psess 83 | *.vsp 84 | *.vspx 85 | 86 | # TFS 2012 Local Workspace 87 | $tf/ 88 | 89 | # Guidance Automation Toolkit 90 | *.gpState 91 | 92 | # ReSharper is a .NET coding add-in 93 | _ReSharper*/ 94 | *.[Rr]e[Ss]harper 95 | *.DotSettings.user 96 | 97 | # JustCode is a .NET coding add-in 98 | .JustCode 99 | 100 | # TeamCity is a build add-in 101 | _TeamCity* 102 | 103 | # DotCover is a Code Coverage Tool 104 | *.dotCover 105 | 106 | # NCrunch 107 | _NCrunch_* 108 | .*crunch*.local.xml 109 | 110 | # MightyMoose 111 | *.mm.* 112 | AutoTest.Net/ 113 | 114 | # Web workbench (sass) 115 | .sass-cache/ 116 | 117 | # Installshield output folder 118 | [Ee]xpress/ 119 | 120 | # DocProject is a documentation generator add-in 121 | DocProject/buildhelp/ 122 | DocProject/Help/*.HxT 123 | DocProject/Help/*.HxC 124 | DocProject/Help/*.hhc 125 | DocProject/Help/*.hhk 126 | DocProject/Help/*.hhp 127 | DocProject/Help/Html2 128 | DocProject/Help/html 129 | 130 | # Click-Once directory 131 | publish/ 132 | 133 | # Publish Web Output 134 | *.[Pp]ublish.xml 135 | *.azurePubxml 136 | ## TODO: Comment the next line if you want to checkin your 137 | ## web deploy settings but do note that will include unencrypted 138 | ## passwords 139 | #*.pubxml 140 | 141 | *.publishproj 142 | 143 | # NuGet Packages 144 | *.nupkg 145 | # The packages folder can be ignored because of Package Restore 146 | **/packages/* 147 | # except build/, which is used as an MSBuild target. 148 | !**/packages/build/ 149 | # Uncomment if necessary however generally it will be regenerated when needed 150 | #!**/packages/repositories.config 151 | 152 | # Windows Azure Build Output 153 | csx/ 154 | *.build.csdef 155 | 156 | # Windows Store app package directory 157 | AppPackages/ 158 | 159 | # Visual Studio cache files 160 | # files ending in .cache can be ignored 161 | *.[Cc]ache 162 | # but keep track of directories ending in .cache 163 | !*.[Cc]ache/ 164 | 165 | # Others 166 | ClientBin/ 167 | [Ss]tyle[Cc]op.* 168 | ~$* 169 | *~ 170 | *.dbmdl 171 | *.dbproj.schemaview 172 | *.pfx 173 | *.publishsettings 174 | node_modules/ 175 | orleans.codegen.cs 176 | 177 | # RIA/Silverlight projects 178 | Generated_Code/ 179 | 180 | # Backup & report files from converting an old project file 181 | # to a newer Visual Studio version. Backup files are not needed, 182 | # because we have git ;-) 183 | _UpgradeReport_Files/ 184 | Backup*/ 185 | UpgradeLog*.XML 186 | UpgradeLog*.htm 187 | 188 | # SQL Server files 189 | *.mdf 190 | *.ldf 191 | 192 | # Business Intelligence projects 193 | *.rdl.data 194 | *.bim.layout 195 | *.bim_*.settings 196 | 197 | # Microsoft Fakes 198 | FakesAssemblies/ 199 | 200 | # Node.js Tools for Visual Studio 201 | .ntvs_analysis.dat 202 | 203 | # Visual Studio 6 build log 204 | *.plg 205 | 206 | # Visual Studio 6 workspace options file 207 | *.opt 208 | 209 | # LightSwitch generated files 210 | GeneratedArtifacts/ 211 | _Pvt_Extensions/ 212 | ModelManifest.xml 213 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "powershell.codeFormatting.addWhitespaceAroundPipe": true, 3 | "editor.insertSpaces": true, 4 | "editor.tabSize": 2 5 | } -------------------------------------------------------------------------------- /Aliases/Azure.Extensions.Aliases.json: -------------------------------------------------------------------------------- 1 | { 2 | "aliases": [ 3 | { 4 | "Description": "Invokes a Remote Desktop Connection to an Azure Virtual Machine (Service Management).", 5 | "Name": "azrdp", 6 | "Value": "Invoke-AzureRemoteDesktop" 7 | }, 8 | { 9 | "Description": "Invokes a Remote Desktop Connection to an Azure Virtual Machine (Resource Manager).", 10 | "Name": "azrmrdp", 11 | "Value": "Invoke-AzureRmRemoteDesktop" 12 | }, 13 | { 14 | "Description": "Publish a local file to an Azure Storage Blob Container.", 15 | "Name": "pubazblob", 16 | "Value": "Publish-AzureRMStorageBlob" 17 | }, 18 | { 19 | "Description": "Remove one or more Azure Storage Blobs from a Container.", 20 | "Name": "unpubazblob", 21 | "Value": "Unpublish-AzureRMStorageBlob" 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /Aliases/Azure.Subscription.Aliases.json: -------------------------------------------------------------------------------- 1 | { 2 | "aliases": [ 3 | { 4 | "Description": "Retrieves a list of Azure subscriptions.", 5 | "Name": "gazsub", 6 | "Value": "Get-AzureSubscription" 7 | }, 8 | { 9 | "Description": "Makes an Azure subscription the \"current\" subscription.", 10 | "Name": "selazsub", 11 | "Value": "Select-AzureSubscription" 12 | }, 13 | { 14 | "Description": "Update an Azure subscription.", 15 | "Name": "sazsub", 16 | "Value": "Set-AzureSubscription" 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /Aliases/AzureRm.AppService.Aliases.json: -------------------------------------------------------------------------------- 1 | { 2 | "aliases": [ 3 | { 4 | "Description": "Creates a new Azure Web App.", 5 | "Name": "nazrmwa", 6 | "Value": "New-AzureRmWebApp" 7 | }, 8 | { 9 | "Description": "Removes an Azure Web App.", 10 | "Name": "razrmwa", 11 | "Value": "Remove-AzureRmWebApp" 12 | }, 13 | { 14 | "Description": "Starts an Azure Web App.", 15 | "Name": "saazrmwa", 16 | "Value": "Start-AzureRmWebApp" 17 | }, 18 | { 19 | "Description": "Stops an Azure Web App.", 20 | "Name": "spazrmwa", 21 | "Value": "Stop-AzureRmWebApp" 22 | }, 23 | { 24 | "Description": "Retrieves an Azure Web App.", 25 | "Name": "gazrmwa", 26 | "Value": "Get-AzureRmWebApp" 27 | }, 28 | { 29 | "Description": "Retrieves the publishing profile for an Azure Web App.", 30 | "Name": "gazrmwapub", 31 | "Value": "Get-AzureRmWebAppPublishingProfile" 32 | } 33 | ] 34 | } -------------------------------------------------------------------------------- /Aliases/AzureRm.Profile.Aliases.json: -------------------------------------------------------------------------------- 1 | { 2 | "aliases": [ 3 | { 4 | "Name": "nazpr", 5 | "Value": "New-AzureRmProfile", 6 | "Description": "Creates a new Azure Profile object." 7 | }, 8 | { 9 | "Name": "razpr", 10 | "Value": "Remove-AzureRmProfile", 11 | "Description": "Removes an Azure Profile object." 12 | }, 13 | { 14 | "Description": "Makes an Azure Profile the \"current\" profile.", 15 | "Name": "selazpr", 16 | "Value": "Select-AzureRMProfile" 17 | }, 18 | { 19 | "Name": "clazpr", 20 | "Value": "Clear-AzureRmProfile" 21 | }, 22 | { 23 | "Name": "svazpr", 24 | "Value": "Save-AzureRmProfile" 25 | }, 26 | { 27 | "Name": "saazrm", 28 | "Value": "Start-AzureRm" 29 | } 30 | ] 31 | } -------------------------------------------------------------------------------- /Aliases/AzureRm.ResourceManager.Aliases.json: -------------------------------------------------------------------------------- 1 | { 2 | "aliases": [ 3 | { 4 | "Description": "Retrieves an Azure Resource Manager Resource Group.", 5 | "Name": "gazrg", 6 | "Value": "Get-AzureRMResourceGroup" 7 | }, 8 | { 9 | "Description": "Creates an Azure Resource Manager Resource Group.", 10 | "Name": "nazrg", 11 | "Value": "New-AzureRMResourceGroup" 12 | }, 13 | { 14 | "Description": "Removes an Azure Resource Manager Resource Group.", 15 | "Name": "razrg", 16 | "Value": "Remove-AzureRMResourceGroup" 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /Aliases/AzureRm.SqlServer.Aliases.json: -------------------------------------------------------------------------------- 1 | { 2 | "aliases": [ 3 | { 4 | "Description": "Creates a new Azure SQL Server.", 5 | "Name": "nazrmsqlsrv", 6 | "Value": "New-AzureRmSqlServer" 7 | }, 8 | { 9 | "Description": "Creates a new Azure SQL Server.", 10 | "Name": "razrmsqlsrv", 11 | "Value": "Remove-AzureRmSqlServer" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /Aliases/AzureRm.Storage.Aliases.json: -------------------------------------------------------------------------------- 1 | { 2 | "aliases": [ 3 | { 4 | "Name": "nazrmsa", 5 | "Value": "New-AzureRmStorageAccount" 6 | }, 7 | { 8 | "Name": "razrmsa", 9 | "Value": "Remove-AzureRmStorageAccount" 10 | }, 11 | { 12 | "Name": "sazrmsa", 13 | "Value": "Set-AzureRmStorageAccount" 14 | }, 15 | { 16 | "Name": "nazrmscon", 17 | "Value": "New-AzureRmStorageContainer" 18 | }, 19 | { 20 | "Name": "razrmscon", 21 | "Value": "Remove-AzureRmStorageContainer" 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /Aliases/AzureRm.VirtualMachine.Aliases.json: -------------------------------------------------------------------------------- 1 | { 2 | "aliases": [ 3 | { 4 | "Description": "Creates a new Azure Resource Manager Virtual Machine.", 5 | "Name": "nazvm", 6 | "Value": "New-AzureRMVM" 7 | }, 8 | { 9 | "Description": "Removes an Azure Resource Manager Virtual Machine, but leaves the VHD blobs intact.", 10 | "Name": "razvm", 11 | "Value": "Remove-AzureRMVM" 12 | }, 13 | { 14 | "Description": "Stops an Azure Resource Manager Virtual Machine.", 15 | "Name": "spazvm", 16 | "Value": "Stop-AzureRMVM" 17 | }, 18 | { 19 | "Description": "Starts an Azure Resource Manager Virtual Machine.", 20 | "Name": "saazvm", 21 | "Value": "Start-AzureRMVM" 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /Aliases/README.MD: -------------------------------------------------------------------------------- 1 | The Microsoft Azure PowerShell module does not offer aliases out of the box, which can make interactive usage more challenging. 2 | This project aims to provide aliases as a means to simplify the interactive use of the core Azure PowerShell experience. 3 | 4 | This folder contains a series of JSON files that declare command aliases, that will be exported from this PowerShell module. 5 | 6 | Each JSON file contains a root element called "aliases," which contains an array of JSON objects, each of which declares a single alias. 7 | Each JSON object representing an alias **must** have the following properties: 8 | 9 | - **Name** - The name of the alias, that will be called by the user. 10 | - **Value** - The full command name that the alias points to. 11 | - **Description** - A brief description of what the alias performs. 12 | 13 | When the **AzureExt** PowerShell module is imported, the `Aliases` folder is scanned for files with the `.json` file extension. 14 | The `aliases` property, at the root of each JSON file, is scanned for an array of JSON objects, and for each object that is found, an alias will be created. 15 | 16 | **NOTE**: Each JSON file should contain aliases that target a specific feature area of the Microsoft Azure platform (eg. SQL Database, Storage, Authentication, Subscription Management, etc.) -------------------------------------------------------------------------------- /Azure-PowerShell-Extensions.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25123.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{F5034706-568F-408A-B7B3-4D38C6DB8A32}") = "AzureExt", "AzureExt.pssproj", "{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Release|Any CPU.Build.0 = Release|Any CPU 18 | {B7134C23-D785-45C7-BFC4-D585DCA9E4F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {B7134C23-D785-45C7-BFC4-D585DCA9E4F1}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {B7134C23-D785-45C7-BFC4-D585DCA9E4F1}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {B7134C23-D785-45C7-BFC4-D585DCA9E4F1}.Release|Any CPU.Build.0 = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /AzureExt.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcgeek86/azure-powershell-extensions/05d83a51849addd90b7446cf8e4dae775428a5b5/AzureExt.psd1 -------------------------------------------------------------------------------- /AzureExt.psm1: -------------------------------------------------------------------------------- 1 | #region Aliases 2 | ### This section contains aliases that will be exported from the module. 3 | 4 | ### Import all aliases from the Aliases folder. 5 | $AliasFileList = Get-ChildItem -Path $PSScriptRoot\Aliases\*Aliases.json; 6 | foreach ($AliasFile in $AliasFileList){ 7 | $AliasJson = ConvertFrom-Json -InputObject (Get-Content -Path $AliasFile -Raw); 8 | foreach ($Alias in $AliasJson.Aliases) { 9 | ### Validate that each alias has a name and value defined. The description is optional. 10 | if ($Alias.Name -and $Alias.Value) { 11 | $NewAlias = @{ 12 | Name = $Alias.Name; 13 | Value = $Alias.Value; 14 | Description = $Alias.Description; 15 | } 16 | New-Alias @NewAlias; 17 | } else { 18 | Write-Warning -Message ('Alias skipped in file {0}' -f $AliasFile.Name); 19 | } 20 | } 21 | } 22 | #endregion 23 | 24 | #region Functions 25 | 26 | #region Public Functions 27 | $FunctionList = Get-ChildItem -Path $PSScriptRoot\Functions\Public; 28 | foreach ($Function in $FunctionList) { 29 | Write-Verbose -Message ('Importing function file: {0}' -f $Function.FullName); 30 | . $Function.FullName; 31 | } 32 | #endregion Public Functions 33 | 34 | #region Private Functions 35 | $FunctionList = Get-ChildItem -Path $PSScriptRoot\Functions\Private; 36 | foreach ($Function in $FunctionList) { 37 | Write-Verbose -Message ('Importing function file: {0}' -f $Function.FullName); 38 | . $Function.FullName; 39 | } 40 | #endregion Private Functions 41 | 42 | #endregion Functions 43 | 44 | #region Import Argument Completers 45 | $CompleterScriptList = Get-ChildItem -Path $PSScriptRoot\Completers\*.ps1; 46 | 47 | foreach ($CompleterScript in $CompleterScriptList) { 48 | Write-Verbose -Message ('Import argument completer script: {0}' -f $CompleterScript.FullName); 49 | & $CompleterScript.FullName; 50 | } 51 | Write-Verbose -Message 'Finished importing argument completer scripts.'; 52 | #endregion 53 | 54 | #region Format Data 55 | $FormatFileList = Get-ChildItem -Path "$PSScriptRoot\Format Types\*" -Filter *format.ps1xml; 56 | foreach ($FormatFile in $FormatFileList) { 57 | Update-FormatData -PrependPath $FormatFile.FullName; 58 | Write-Verbose -Message ('Added format file: {0}' -f $FormatFile.Name); 59 | } 60 | #endregion 61 | 62 | -------------------------------------------------------------------------------- /AzureExt.pssproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | 2.0 6 | 6CAFC0C6-A428-4d30-A9F9-700E829FEA51 7 | Exe 8 | MyApplication 9 | MyApplication 10 | AzureExt 11 | 12 | 13 | 14 | true 15 | full 16 | false 17 | bin\Debug\ 18 | DEBUG;TRACE 19 | prompt 20 | 4 21 | 22 | 23 | pdbonly 24 | true 25 | bin\Release\ 26 | TRACE 27 | prompt 28 | 4 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /Completers/Microsoft.Az.Automation.AutomationAccountName.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ScriptBlock = { 2 | <# 3 | .SYNOPSIS 4 | Auto-complete the -AutomationAccountName parameter value for Azure Resource Manager (ARM) PowerShell cmdlets. 5 | 6 | .NOTES 7 | Created by Trevor Sullivan 8 | http://trevorsullivan.net 9 | #> 10 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 11 | 12 | try { 13 | $ObjectList = Get-AzAutomationAccount -ErrorAction Stop -WarningAction Ignore; 14 | } catch { 15 | Write-Host -Object ('Error occurred retrieving Automation Accounts: {0}' -f $PSItem.Exception.Message); 16 | } 17 | $ItemList = $ObjectList | Where-Object { $PSItem.AutomationAccountName -match $wordToComplete } | ForEach-Object { 18 | $CompletionText = '{0} -ResourceGroupName {1}' -f $PSItem.AutomationAccountName, $PSItem.ResourceGroupName; 19 | $ToolTip = 'Automation Account {0} in {1} region, in {2} Resource Group.' -f $PSItem.AutomationAccountName, $PSItem.Location, $PSItem.ResourceGroupName; 20 | $ListItemText = '{0} ({1})' -f $PSItem.AutomationAccountName, $PSItem.Location; 21 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 22 | 23 | [System.Management.Automation.CompletionResult]::new($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 24 | } 25 | 26 | return $ItemList 27 | } 28 | 29 | $ArgumentCompleter = @{ 30 | CommandName = @( 31 | 'Export-AzAutomationDscConfiguration', 32 | 'Export-AzAutomationDscNodeReportContent', 33 | 'Export-AzAutomationRunbook', 34 | 'Get-AzAutomationAccount', 35 | 'Get-AzAutomationCertificate', 36 | 'Get-AzAutomationConnection', 37 | 'Get-AzAutomationCredential', 38 | 'Get-AzAutomationDscCompilationJob', 39 | 'Get-AzAutomationDscCompilationJobOutput', 40 | 'Get-AzAutomationDscConfiguration', 41 | 'Get-AzAutomationDscNode', 42 | 'Get-AzAutomationDscNodeConfiguration', 43 | 'Get-AzAutomationDscNodeReport', 44 | 'Get-AzAutomationDscOnboardingMetaconfig', 45 | 'Get-AzAutomationJob', 46 | 'Get-AzAutomationJobOutput', 47 | 'Get-AzAutomationJobOutputRecord', 48 | 'Get-AzAutomationModule', 49 | 'Get-AzAutomationRegistrationInfo', 50 | 'Get-AzAutomationRunbook', 51 | 'Get-AzAutomationSchedule', 52 | 'Get-AzAutomationScheduledRunbook', 53 | 'Get-AzAutomationVariable', 54 | 'Get-AzAutomationWebhook', 55 | 'Import-AzAutomationDscConfiguration', 56 | 'Import-AzAutomationDscNodeConfiguration', 57 | 'Import-AzAutomationRunbook', 58 | 'New-AzAutomationAccount', 59 | 'New-AzAutomationCertificate', 60 | 'New-AzAutomationConnection', 61 | 'New-AzAutomationCredential', 62 | 'New-AzAutomationKey', 63 | 'New-AzAutomationModule', 64 | 'New-AzAutomationRunbook', 65 | 'New-AzAutomationSchedule', 66 | 'New-AzAutomationVariable', 67 | 'New-AzAutomationWebhook', 68 | 'Publish-AzAutomationRunbook', 69 | 'Register-AzAutomationDscNode', 70 | 'Register-AzAutomationScheduledRunbook', 71 | 'Remove-AzAutomationAccount', 72 | 'Remove-AzAutomationCertificate', 73 | 'Remove-AzAutomationConnection', 74 | 'Remove-AzAutomationConnectionType', 75 | 'Remove-AzAutomationCredential', 76 | 'Remove-AzAutomationDscConfiguration', 77 | 'Remove-AzAutomationDscNodeConfiguration', 78 | 'Remove-AzAutomationModule', 79 | 'Remove-AzAutomationRunbook', 80 | 'Remove-AzAutomationSchedule', 81 | 'Remove-AzAutomationVariable', 82 | 'Remove-AzAutomationWebhook', 83 | 'Resume-AzAutomationJob', 84 | 'Set-AzAutomationAccount', 85 | 'Set-AzAutomationCertificate', 86 | 'Set-AzAutomationConnectionFieldValue', 87 | 'Set-AzAutomationCredential', 88 | 'Set-AzAutomationDscNode', 89 | 'Set-AzAutomationModule', 90 | 'Set-AzAutomationRunbook', 91 | 'Set-AzAutomationSchedule', 92 | 'Set-AzAutomationVariable', 93 | 'Set-AzAutomationWebhook', 94 | 'Start-AzAutomationDscCompilationJob', 95 | 'Start-AzAutomationRunbook', 96 | 'Stop-AzAutomationJob', 97 | 'Suspend-AzAutomationJob', 98 | 'Unregister-AzAutomationDscNode', 99 | 'Unregister-AzAutomationScheduledRunbook' 100 | ); 101 | ParameterName = 'AutomationAccountName'; 102 | ScriptBlock = $ScriptBlock; 103 | } 104 | 105 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; 106 | 107 | $ArgumentCompleter = @{ 108 | CommandName = @( 109 | 'Get-AzAutomationAccount', 110 | 'New-AzAutomationAccount', 111 | 'Remove-AzAutomationAccount', 112 | 'Set-AzAutomationAccount' 113 | ); 114 | ParameterName = 'Name'; 115 | ScriptBlock = $ScriptBlock; 116 | } 117 | 118 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; -------------------------------------------------------------------------------- /Completers/Microsoft.Az.Automation.RunbookName.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ScriptBlock = { 2 | <# 3 | .SYNOPSIS 4 | Auto-complete the -Name parameter value for Azure Automation Runbook Azure Resource Manager (ARM) PowerShell cmdlets. 5 | 6 | NOTE: Use this command to find commands that this auto-completer applies to: 7 | (Get-Command -Module Az.Automation -Name *runbook* -ParameterName Name).ForEach({ "'{0}'" -f $PSItem.Name }) | Set-Clipboard 8 | 9 | .NOTES 10 | Created by Trevor Sullivan 11 | http://trevorsullivan.net 12 | #> 13 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 14 | 15 | try { 16 | $ObjectList = Get-AzAutomationRunbook -AutomationAccountName $fakeBoundParameter["AutomationAccountName"] -ResourceGroupName $fakeBoundParameter["ResourceGroupName"] -ErrorAction Stop -WarningAction Ignore; 17 | } catch { 18 | Write-Host -Object ('Error occurred retrieving Automation Runbooks: {0}' -f $PSItem.Exception.Message); 19 | } 20 | $ItemList = $ObjectList | Where-Object { $PSItem.Name -match $wordToComplete } | ForEach-Object { 21 | $CompletionText = $PSItem.Name; 22 | $ToolTip = 'Runbook {0} in {1} Automation Account.' -f $PSItem.Name, $PSItem.AutomationAccountName; 23 | $ListItemText = '{0}' -f $PSItem.Name; 24 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 25 | 26 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 27 | } 28 | 29 | return $ItemList 30 | } 31 | 32 | $ArgumentCompleter = @{ 33 | CommandName = @( 34 | 'Export-AzAutomationRunbook' 35 | 'Get-AzAutomationRunbook' 36 | 'Get-AzAutomationScheduledRunbook' 37 | 'Import-AzAutomationRunbook' 38 | 'New-AzAutomationRunbook' 39 | 'Publish-AzAutomationRunbook' 40 | 'Register-AzAutomationScheduledRunbook' 41 | 'Remove-AzAutomationRunbook' 42 | 'Set-AzAutomationRunbook' 43 | 'Start-AzAutomationRunbook' 44 | 'Unregister-AzAutomationScheduledRunbook' 45 | ); 46 | ParameterName = 'Name'; 47 | ScriptBlock = $ScriptBlock; 48 | } 49 | 50 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; 51 | -------------------------------------------------------------------------------- /Completers/Microsoft.Az.CDN.ProfileName.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ScriptBlock = { 2 | <# 3 | .SYNOPSIS 4 | Auto-complete the -ProfileName parameter value for Azure Resource Manager (ARM) PowerShell cmdlets for Azure CDN. 5 | 6 | .NOTES 7 | 8 | Created by Trevor Sullivan 9 | http://trevorsullivan.net 10 | #> 11 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 12 | 13 | try { 14 | $CompletionList = Get-AzCdnProfile | Where-Object -FilterScript { $PSItem.Name -match $wordToComplete } | ForEach-Object { 15 | $CompletionText = '{0} -ResourceGroupName {1}' -f $PSItem.Name, $PSItem.ResourceGroupName; 16 | $ToolTip = 'Redis Cache "{0}" in "{1}" region, member of "{2}" Resource Group.' -f $PSItem.Name, $PSItem.Location, $PSItem.ResourceGroupName; 17 | $ListItemText = '{0} ({1}, {2})' -f $PSItem.Name, $PSItem.ResourceGroupName, $PSItem.Location; 18 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 19 | 20 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 21 | } 22 | 23 | return $CompletionList; 24 | } 25 | catch { 26 | Write-Host -Message ('Error occurred calling argument completer: {0}' -f $PSItem.Exception.Message); 27 | } 28 | }; 29 | 30 | $ArgumentCompleterList = @( 31 | @{ 32 | # Use this command to regenerate the list of commands below, in case it changes. 33 | # (Get-Command -Module Az.Cdn -ParameterName ProfileName).Name | % { "'{0}'" -f $_ } 34 | CommandName = @( 35 | 'Validate-AzCdnCustomDomain' 36 | 'Disable-AzCdnCustomDomain' 37 | 'Disable-AzCdnCustomDomainHttps' 38 | 'Enable-AzCdnCustomDomain' 39 | 'Enable-AzCdnCustomDomainHttps' 40 | 'Get-AzCdnCustomDomain' 41 | 'Get-AzCdnEndpoint' 42 | 'Get-AzCdnEndpointResourceUsage' 43 | 'Get-AzCdnOrigin' 44 | 'Get-AzCdnProfile' 45 | 'Get-AzCdnProfileResourceUsage' 46 | 'Get-AzCdnProfileSsoUrl' 47 | 'Get-AzCdnProfileSupportedOptimizationType' 48 | 'New-AzCdnCustomDomain' 49 | 'New-AzCdnEndpoint' 50 | 'New-AzCdnProfile' 51 | 'Publish-AzCdnEndpointContent' 52 | 'Remove-AzCdnCustomDomain' 53 | 'Remove-AzCdnEndpoint' 54 | 'Remove-AzCdnProfile' 55 | 'Start-AzCdnEndpoint' 56 | 'Stop-AzCdnEndpoint' 57 | 'Test-AzCdnCustomDomain' 58 | 'Unpublish-AzCdnEndpointContent' 59 | ); 60 | ParameterName = 'ProfileName'; 61 | ScriptBlock = $ScriptBlock; 62 | }; 63 | ) 64 | 65 | foreach ($ArgumentCompleter in $ArgumentCompleterList) { 66 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; 67 | } -------------------------------------------------------------------------------- /Completers/Microsoft.Az.ContainerGroup.Name.ArgumentCompleters copy.ps1: -------------------------------------------------------------------------------- 1 | $ScriptBlock = { 2 | <# 3 | .SYNOPSIS 4 | Auto-complete the -ProfileName parameter value for Azure Resource Manager (ARM) PowerShell cmdlets for Azure CDN. 5 | 6 | .NOTES 7 | 8 | Created by Trevor Sullivan 9 | http://trevorsullivan.net 10 | #> 11 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 12 | 13 | try { 14 | $CompletionList = Get-AzContainerGroup | Where-Object -FilterScript { $PSItem.Name -match $wordToComplete } | ForEach-Object { 15 | $CompletionText = '{0} -ResourceGroupName {1}' -f $PSItem.Name, $PSItem.ResourceGroupName; 16 | $ToolTip = 'Redis Cache "{0}" in "{1}" region, member of "{2}" Resource Group.' -f $PSItem.Name, $PSItem.Location, $PSItem.ResourceGroupName; 17 | $ListItemText = '{0} ({1}, {2})' -f $PSItem.Name, $PSItem.ResourceGroupName, $PSItem.Location; 18 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 19 | 20 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 21 | } 22 | 23 | return $CompletionList; 24 | } 25 | catch { 26 | Write-Host -Message ('Error occurred calling argument completer: {0}' -f $PSItem.Exception.Message); 27 | } 28 | }; 29 | 30 | $ArgumentCompleterList = @( 31 | @{ 32 | CommandName = @( 33 | 'Remove-AzContainerGroup' 34 | 'Get-AzContainerGroup' 35 | ); 36 | ParameterName = 'Name'; 37 | ScriptBlock = $ScriptBlock; 38 | }; 39 | ) 40 | 41 | foreach ($ArgumentCompleter in $ArgumentCompleterList) { 42 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; 43 | } 44 | 45 | $ArgumentCompleterList = @( 46 | @{ 47 | CommandName = @( 48 | 'Get-AzContainerInstanceLog' 49 | ); 50 | ParameterName = 'ContainerGroupName'; 51 | ScriptBlock = $ScriptBlock; 52 | }; 53 | ) 54 | 55 | foreach ($ArgumentCompleter in $ArgumentCompleterList) { 56 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; 57 | } -------------------------------------------------------------------------------- /Completers/Microsoft.Az.DNS.ZoneName.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ScriptBlock = { 2 | <# 3 | .SYNOPSIS 4 | Auto-complete the -ZoneName parameter value for Azure Resource Manager (ARM) PowerShell cmdlets. 5 | 6 | .NOTES 7 | Created by Trevor Sullivan 8 | https://trevorsullivan.net 9 | #> 10 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 11 | 12 | try { 13 | $ObjectList = Get-AzDnsZone -ResourceGroupName $fakeBoundParameter["ResourceGroupName"] -ErrorAction Stop -WarningAction Ignore; 14 | } catch { 15 | Write-Host -Object ('Error occurred retrieving DNS Zones: {0}' -f $PSItem.Exception.Message); 16 | } 17 | $ItemList = $ObjectList | Where-Object { $PSItem.Name -match $wordToComplete } | ForEach-Object { 18 | $CompletionText = '{0}' -f $PSItem.Name; 19 | $ToolTip = 'DNS Zone {0} in {1} Resource Group.' -f $PSItem.Name, $PSItem.ResourceGroupName; 20 | $ListItemText = '{0}' -f $PSItem.Name; 21 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 22 | 23 | [System.Management.Automation.CompletionResult]::new($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 24 | } 25 | 26 | return $ItemList 27 | } 28 | 29 | $ArgumentCompleter = @{ 30 | CommandName = @( 31 | 'Get-AzDnsRecordSet', 32 | 'New-AzDnsRecordSet', 33 | 'Remove-AzDnsRecordSet' 34 | ); 35 | ParameterName = 'ZoneName'; 36 | ScriptBlock = $ScriptBlock; 37 | } 38 | 39 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; 40 | 41 | $ArgumentCompleter = @{ 42 | CommandName = @( 43 | 'Get-AzDnsZone', 44 | 'New-AzDnsZone', 45 | 'Remove-AzDnsZone', 46 | 'Set-AzDnsZone' 47 | ); 48 | ParameterName = 'Name'; 49 | ScriptBlock = $ScriptBlock; 50 | } 51 | 52 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; -------------------------------------------------------------------------------- /Completers/Microsoft.Az.Locations.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ArgumentCompleter = @{ 2 | CommandName = @( 3 | 'Add-AlertRule', 4 | 'Add-AutoscaleSetting', 5 | 'Add-AzApiManagementRegion', 6 | 'Get-AzHDInsightProperties', 7 | 'Get-AzStreamAnalyticsQuota', 8 | 'Get-AzVMExtensionImage', 9 | 'Get-AzVMExtensionImageType', 10 | 'Get-AzVMImage', 11 | 'Get-AzVMImageOffer', 12 | 'Get-AzVMImagePublisher', 13 | 'Get-AzVMImageSku', 14 | 'Get-AzVMSize', 15 | 'Get-AzVMUsage', 16 | 'New-AzApiManagement', 17 | 'New-AzApiManagementVirtualNetwork', 18 | 'New-AzApplicationGateway', 19 | 'New-AzAppServicePlan', 20 | 'New-AzAutomationAccount', 21 | 'New-AzAvailabilitySet', 22 | 'New-AzBatchAccount', 23 | 'New-AzDataFactory', 24 | 'New-AzHDInsightCluster', 25 | 'New-AzKeyVault', 26 | 'New-AzLoadBalancer', 27 | 'New-AzLocalNetworkGateway', 28 | 'New-AzNetworkInterface', 29 | 'New-AzNetworkSecurityGroup', 30 | 'New-AzOperationalInsightsWorkspace', 31 | 'New-AzPublicIpAddress', 32 | 'New-AzRedisCache', 33 | 'New-AzResource', 34 | 'New-AzResourceGroup', 35 | 'New-AzRouteTable', 36 | 'New-AzSiteRecoveryVault', 37 | 'New-AzSqlServer', 38 | 'New-AzStorageAccount', 39 | 'New-AzVirtualNetwork', 40 | 'New-AzVirtualNetworkGateway', 41 | 'New-AzVirtualNetworkGatewayConnection', 42 | 'New-AzVM', 43 | 'New-AzWebApp', 44 | 'Remove-AzApiManagementRegion', 45 | 'Set-AzAppServicePlan', 46 | 'Set-AzVMAccessExtension', 47 | 'Set-AzVMCustomScriptExtension', 48 | 'Set-AzVMDiagnosticsExtension', 49 | 'Set-AzVMDscExtension', 50 | 'Set-AzVMExtension', 51 | 'Set-AzVMSqlServerExtension', 52 | 'Test-AzDnsAvailability', 53 | 'Update-AzApiManagementDeployment', 54 | 'Update-AzApiManagementRegion' 55 | ); 56 | ParameterName = 'Location'; 57 | #Description = 'Complete the -Location parameter value for Azure Resource Manager cmdlets: New-AzureResource -Location '; 58 | ScriptBlock = { 59 | <# 60 | .SYNOPSIS 61 | Auto-complete the -Location parameter value for Azure cmdlets. 62 | 63 | .NOTES 64 | Created by Trevor Sullivan 65 | http://trevorsullivan.net 66 | http://twitter.com/pcgeek86 67 | #> 68 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 69 | 70 | function Get-AllAzureLocations { 71 | <# 72 | .Synopsis 73 | Retrieves a list of Azure locations, using the AzureResourceManager PowerShell module. 74 | 75 | .Description 76 | This function may be deprecated, or require modification, if the Get-AzureLocation command is changed 77 | from returning Azure platform features, to returning Azure locations. As of this implementation, the 78 | ARM Get-AzureLocation command returns a list of Azure Resource Providers as the top-level object. 79 | 80 | NOTE: This argument completer requires that the user be authenticated to Microsoft Azure. 81 | #> 82 | [CmdletBinding()] 83 | param () 84 | 85 | $LocationList = (Get-AzResourceProvider).Locations | Select-Object -Unique | Sort-Object; 86 | Write-Output -InputObject $LocationList; 87 | } 88 | 89 | ### Create fresh completion results for Azure virtual machines 90 | $ItemList = Get-AllAzureLocations | Where-Object { $PSItem -match $wordToComplete } | ForEach-Object { 91 | $CompletionText = $PSItem; 92 | $ToolTip = $PSItem; 93 | $ListItemText = $PSItem; 94 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 95 | 96 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 97 | } 98 | 99 | ### Return the fresh completion results 100 | return $ItemList; 101 | } 102 | } 103 | 104 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; -------------------------------------------------------------------------------- /Completers/Microsoft.Az.NetworkInterface.Name.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ScriptBlock = { 2 | <# 3 | .SYNOPSIS 4 | Auto-complete the -Name parameter value for Azure Resource Manager (ARM) PowerShell cmdlets for Network Interfaces. 5 | 6 | .NOTES 7 | 8 | Created by Trevor Sullivan 9 | http://trevorsullivan.net 10 | #> 11 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 12 | 13 | try { 14 | $CompletionList = Get-AzNetworkInterface | Where-Object -FilterScript { $PSItem.Name -match $wordToComplete } | ForEach-Object { 15 | $CompletionText = '{0} -ResourceGroupName {1}' -f $PSItem.Name, $PSItem.ResourceGroupName; 16 | $ToolTip = 'Network Interface "{0}" in "{1}" region, member of "{2}" Resource Group.' -f $PSItem.Name, $PSItem.Location, $PSItem.ResourceGroup; 17 | $ListItemText = '{0}\{1} ({2})' -f $PSItem.ResourceGroupName, $PSItem.Name, $PSItem.Location; 18 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 19 | 20 | [System.Management.Automation.CompletionResult]::new($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 21 | } 22 | 23 | return $CompletionList; 24 | } 25 | catch { 26 | Write-Host -Message ('Error occurred calling argument completer: {0}' -f $PSItem.Exception.Message); 27 | } 28 | }; 29 | 30 | $ArgumentCompleterList = @( 31 | @{ 32 | CommandName = @( 33 | 'Get-AzNetworkInterface' 34 | 'New-AzNetworkInterface' 35 | 'Remove-AzNetworkInterface' 36 | 'Set-AzNetworkInterface' 37 | ); 38 | ParameterName = 'Name'; 39 | #Description = 'Complete the -Name parameter value for Azure Resource Manager (ARM) Network Interface cmdlets: Get-AzNetworkInterface -Name '; 40 | ScriptBlock = $ScriptBlock; 41 | }; 42 | ) 43 | 44 | foreach ($ArgumentCompleter in $ArgumentCompleterList) { 45 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; 46 | } -------------------------------------------------------------------------------- /Completers/Microsoft.Az.RedisCache.Name.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ScriptBlock = { 2 | <# 3 | .SYNOPSIS 4 | Auto-complete the -Name parameter value for Azure Resource Manager (ARM) PowerShell cmdlets for Redis Cache. 5 | 6 | .NOTES 7 | 8 | Created by Trevor Sullivan 9 | http://trevorsullivan.net 10 | #> 11 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 12 | 13 | try { 14 | $CompletionList = Get-AzRedisCache | Where-Object -FilterScript { $PSItem.Name -match $wordToComplete } | ForEach-Object { 15 | $CompletionText = '{0} -ResourceGroupName {1}' -f $PSItem.Name, $PSItem.ResourceGroupName; 16 | $ToolTip = 'Redis Cache "{0}" in "{1}" region, member of "{2}" Resource Group.' -f $PSItem.Name, $PSItem.Location, $PSItem.ResourceGroupName; 17 | $ListItemText = '{0} ({1}, {2})' -f $PSItem.Name, $PSItem.ResourceGroupName, $PSItem.Location; 18 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 19 | 20 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 21 | } 22 | 23 | return $CompletionList; 24 | } 25 | catch { 26 | Write-Host -Message ('Error occurred calling argument completer: {0}' -f $PSItem.Exception.Message); 27 | } 28 | }; 29 | 30 | $ArgumentCompleterList = @( 31 | @{ 32 | CommandName = @( 33 | 'Get-AzRedisCache' 34 | 'Get-AzRedisCacheKey' 35 | 'New-AzRedisCache' 36 | 'New-AzRedisCacheKey' 37 | 'Remove-AzRedisCache' 38 | 'Set-AzRedisCache' 39 | ); 40 | ParameterName = 'Name'; 41 | #Description = 'Complete the -Name parameter value for Azure Resource Manager (ARM) Redis Cache cmdlets: Get-AzRedisCache -Name '; 42 | ScriptBlock = $ScriptBlock; 43 | }; 44 | ) 45 | 46 | foreach ($ArgumentCompleter in $ArgumentCompleterList) { 47 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; 48 | } -------------------------------------------------------------------------------- /Completers/Microsoft.Az.Resource.Name.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ArgumentCompleter = @{ 2 | CommandName = @( 3 | 'Get-AzResource' 4 | 'Get-AzResourceLock' 5 | 'Get-AzRoleAssignment' 6 | 'Invoke-AzResourceAction' 7 | 'New-AzResource' 8 | 'New-AzResourceLock' 9 | 'New-AzRoleAssignment' 10 | 'Remove-AzResource' 11 | 'Remove-AzResourceLock' 12 | 'Remove-AzRoleAssignment' 13 | 'Set-AzResource' 14 | 'Set-AzResourceLock' 15 | ); 16 | ParameterName = 'ResourceName'; 17 | #Description = 'Complete the -ResourceName parameter value for Azure Resource Manager cmdlets: Get-AzureResource -ResourceName '; 18 | ScriptBlock = { 19 | <# 20 | .SYNOPSIS 21 | Auto-complete the -ResourceName parameter value for Azure Resource Manager (ARM) cmdlets. 22 | 23 | .NOTES 24 | Created by Trevor Sullivan 25 | http://trevorsullivan.net 26 | http://twitter.com/pcgeek86 27 | #> 28 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 29 | 30 | ### Create fresh completion results for Azure virtual machines 31 | $ItemList = Get-AzResource | Where-Object { $PSItem.ResourceName -match $wordToComplete } | ForEach-Object { 32 | $CompletionText = '{0} -ResourceType {1} -ResourceGroupName {2}' -f $PSItem.ResourceName, $PSItem.ResourceType, $PSItem.ResourceGroupName; 33 | $ToolTip = 'Resource {0} of type {1} in Resource Group {2}' -f $PSItem.ResourceName, $PSItem.ResourceType, $PSItem.ResourceGroupName; 34 | $ListItemText = '{0} ({1})' -f $PSItem.ResourceName, $PSItem.ResourceGroupName; 35 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 36 | 37 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 38 | } 39 | 40 | ### Return the fresh completion results 41 | return $ItemList; 42 | } 43 | } 44 | 45 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; -------------------------------------------------------------------------------- /Completers/Microsoft.Az.ResourceGroup.ResourceGroupName.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ScriptBlock = { 2 | <# 3 | .SYNOPSIS 4 | Auto-complete the -ResourceGroupName parameter value for Azure Resource Manager (ARM) PowerShell cmdlets. 5 | 6 | .NOTES 7 | Created by Trevor Sullivan 8 | http://trevorsullivan.net 9 | #> 10 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 11 | 12 | try { 13 | $ResourceGroupList = Get-AzResourceGroup -ErrorAction Stop -WarningAction Ignore; 14 | } catch { 15 | Write-Host -Object ('Error occurred retrieving resource groups: {0}' -f $PSItem.Exception.Message); 16 | } 17 | $ItemList = $ResourceGroupList | Where-Object { $PSItem.ResourceGroupName -match $wordToComplete } | ForEach-Object { 18 | $CompletionText = $PSItem.ResourceGroupName; 19 | $ToolTip = 'Resource Group {0} in {1} region.' -f $PSItem.ResourceGroupName, $PSItem.Location; 20 | $ListItemText = '{0} ({1})' -f $PSItem.ResourceGroupName, $PSItem.Location; 21 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 22 | 23 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 24 | } 25 | 26 | return $ItemList 27 | } 28 | 29 | $ArgumentCompleter = @{ 30 | CommandName = @( 31 | 'Get-AzSqlDatabaseServerAuditingPolicy' 32 | 'Remove-AzSqlDatabaseServerAuditing' 33 | 'Set-AzSqlDatabaseServerAuditingPolicy' 34 | 'Use-AzSqlDatabaseServerAuditingPolicy' 35 | 'Add-AzVhd' 36 | 'Backup-AzApiManagement' 37 | 'Disable-AzTrafficManagerEndpoint' 38 | 'Disable-AzTrafficManagerProfile' 39 | 'Enable-AzTrafficManagerEndpoint' 40 | 'Enable-AzTrafficManagerProfile' 41 | 'Export-AzAutomationDscConfiguration' 42 | 'Export-AzAutomationDscNodeReportContent' 43 | 'Export-AzAutomationRunbook' 44 | 'Get-AzApiManagement' 45 | 'Get-AzApiManagementSsoToken' 46 | 'Get-AzApplicationGateway' 47 | 'Get-AzAppServicePlan' 48 | 'Get-AzAutomationAccount' 49 | 'Get-AzAutomationCertificate' 50 | 'Get-AzAutomationConnection' 51 | 'Get-AzAutomationCredential' 52 | 'Get-AzAutomationDscCompilationJob' 53 | 'Get-AzAutomationDscCompilationJobOutput' 54 | 'Get-AzAutomationDscConfiguration' 55 | 'Get-AzAutomationDscNode' 56 | 'Get-AzAutomationDscNodeConfiguration' 57 | 'Get-AzAutomationDscNodeReport' 58 | 'Get-AzAutomationDscOnboardingMetaconfig' 59 | 'Get-AzAutomationJob' 60 | 'Get-AzAutomationJobOutput' 61 | 'Get-AzAutomationModule' 62 | 'Get-AzAutomationRegistrationInfo' 63 | 'Get-AzAutomationRunbook' 64 | 'Get-AzAutomationSchedule' 65 | 'Get-AzAutomationScheduledRunbook' 66 | 'Get-AzAutomationVariable' 67 | 'Get-AzAutomationWebhook' 68 | 'Get-AzAvailabilitySet' 69 | 'Get-AzBackupVault' 70 | 'Get-AzBatchAccount' 71 | 'Get-AzBatchAccountKeys' 72 | 'Get-AzDataFactory' 73 | 'Get-AzDataFactoryDataset' 74 | 'Get-AzDataFactoryGateway' 75 | 'Get-AzDataFactoryHub' 76 | 'Get-AzDataFactoryLinkedService' 77 | 'Get-AzDataFactoryPipeline' 78 | 'Get-AzDataFactoryRun' 79 | 'Get-AzDataFactorySlice' 80 | 'Get-AzDnsRecordSet' 81 | 'Get-AzDnsZone' 82 | 'Get-AzHDInsightCluster' 83 | 'Get-AzHDInsightJob' 84 | 'Get-AzHDInsightJobOutput' 85 | 'Get-AzKeyVault' 86 | 'Get-AzLoadBalancer' 87 | 'Get-AzLocalNetworkGateway' 88 | 'Get-AzNetworkInterface' 89 | 'Get-AzNetworkSecurityGroup' 90 | 'Get-AzOperationalInsightsStorageInsight' 91 | 'Get-AzOperationalInsightsWorkspace' 92 | 'Get-AzOperationalInsightsWorkspaceManagementGroups' 93 | 'Get-AzOperationalInsightsWorkspaceSharedKeys' 94 | 'Get-AzOperationalInsightsWorkspaceUsage' 95 | 'Get-AzPublicIpAddress' 96 | 'Get-AzRedisCache' 97 | 'Get-AzRedisCacheKey' 98 | 'Get-AzRemoteDesktopFile' 99 | 'Get-AzResource' 100 | 'Get-AzResourceGroup' 101 | 'Get-AzResourceGroupDeployment' 102 | 'Get-AzResourceGroupDeploymentOperation' 103 | 'Get-AzResourceLock' 104 | 'Get-AzRoleAssignment' 105 | 'Get-AzRouteTable' 106 | 'Get-AzSqlDatabase' 107 | 'Get-AzSqlDatabaseActivity' 108 | 'Get-AzSqlDatabaseAuditingPolicy' 109 | 'Get-AzSqlDatabaseDataMaskingPolicy' 110 | 'Get-AzSqlDatabaseDataMaskingRule' 111 | 'Get-AzSqlDatabaseExpanded' 112 | 'Get-AzSqlDatabaseIndexRecommendations' 113 | 'Get-AzSqlDatabaseReplicationLink' 114 | 'Get-AzSqlDatabaseRestorePoints' 115 | 'Get-AzSqlDatabaseSecureConnectionPolicy' 116 | 'Get-AzSqlDatabaseTransparentDataEncryption' 117 | 'Get-AzSqlDatabaseTransparentDataEncryptionActivity' 118 | 'Get-AzSqlDatabaseUpgradeHint' 119 | 'Get-AzSqlElasticPool' 120 | 'Get-AzSqlElasticPoolActivity' 121 | 'Get-AzSqlElasticPoolDatabase' 122 | 'Get-AzSqlElasticPoolRecommendation' 123 | 'Get-AzSqlServer' 124 | 'Get-AzSqlServerActiveDirectoryAdministrator' 125 | 'Get-AzSqlServerAuditingPolicy' 126 | 'Get-AzSqlServerFirewallRule' 127 | 'Get-AzSqlServerServiceObjective' 128 | 'Get-AzSqlServerUpgrade' 129 | 'Get-AzSqlServerUpgradeHint' 130 | 'Get-AzStreamAnalyticsInput' 131 | 'Get-AzStreamAnalyticsJob' 132 | 'Get-AzStreamAnalyticsOutput' 133 | 'Get-AzStreamAnalyticsTransformation' 134 | 'Get-AzTrafficManagerEndpoint' 135 | 'Get-AzTrafficManagerProfile' 136 | 'Get-AzVirtualNetwork' 137 | 'Get-AzVirtualNetworkGateway' 138 | 'Get-AzVirtualNetworkGatewayConnection' 139 | 'Get-AzVirtualNetworkGatewayConnectionSharedKey' 140 | 'Get-AzVM' 141 | 'Get-AzVMAccessExtension' 142 | 'Get-AzVMCustomScriptExtension' 143 | 'Get-AzVMDiagnosticsExtension' 144 | 'Get-AzVMDscExtension' 145 | 'Get-AzVMExtension' 146 | 'Get-AzVMSize' 147 | 'Get-AzVMSqlServerExtension' 148 | 'Get-AzWebApp' 149 | 'Get-AzWebAppPublishingProfile' 150 | 'Grant-AzHDInsightHttpServicesAccess' 151 | 'Grant-AzHDInsightRdpServicesAccess' 152 | 'Import-AzApiManagementHostnameCertificate' 153 | 'Import-AzAutomationDscConfiguration' 154 | 'Import-AzAutomationRunbook' 155 | 'Invoke-AzResourceAction' 156 | 'New-AzApiManagement' 157 | 'New-AzApiManagementContext' 158 | 'New-AzApplicationGateway' 159 | 'New-AzAppServicePlan' 160 | 'New-AzAutomationAccount' 161 | 'New-AzAutomationCertificate' 162 | 'New-AzAutomationConnection' 163 | 'New-AzAutomationCredential' 164 | 'New-AzAutomationKey' 165 | 'New-AzAutomationModule' 166 | 'New-AzAutomationRunbook' 167 | 'New-AzAutomationSchedule' 168 | 'New-AzAutomationVariable' 169 | 'New-AzAutomationWebhook' 170 | 'New-AzAvailabilitySet' 171 | 'New-AzBackupVault' 172 | 'New-AzBatchAccount' 173 | 'New-AzBatchAccountKey' 174 | 'New-AzDataFactory' 175 | 'New-AzDataFactoryDataset' 176 | 'New-AzDataFactoryEncryptValue' 177 | 'New-AzDataFactoryGateway' 178 | 'New-AzDataFactoryGatewayKey' 179 | 'New-AzDataFactoryHub' 180 | 'New-AzDataFactoryLinkedService' 181 | 'New-AzDataFactoryPipeline' 182 | 'New-AzDnsRecordSet' 183 | 'New-AzDnsZone' 184 | 'New-AzHDInsightCluster' 185 | 'New-AzKeyVault' 186 | 'New-AzLoadBalancer' 187 | 'New-AzLocalNetworkGateway' 188 | 'New-AzNetworkInterface' 189 | 'New-AzNetworkSecurityGroup' 190 | 'New-AzOperationalInsightsStorageInsight' 191 | 'New-AzOperationalInsightsWorkspace' 192 | 'New-AzPublicIpAddress' 193 | 'New-AzRedisCache' 194 | 'New-AzRedisCacheKey' 195 | 'New-AzResource' 196 | 'New-AzResourceGroup' 197 | 'New-AzResourceGroupDeployment' 198 | 'New-AzResourceLock' 199 | 'New-AzRoleAssignment' 200 | 'New-AzRouteTable' 201 | 'New-AzSqlDatabase' 202 | 'New-AzSqlDatabaseCopy' 203 | 'New-AzSqlDatabaseDataMaskingRule' 204 | 'New-AzSqlDatabaseSecondary' 205 | 'New-AzSqlElasticPool' 206 | 'New-AzSqlServer' 207 | 'New-AzSqlServerFirewallRule' 208 | 'New-AzStorageAccount' 209 | 'New-AzStreamAnalyticsInput' 210 | 'New-AzStreamAnalyticsJob' 211 | 'New-AzStreamAnalyticsOutput' 212 | 'New-AzStreamAnalyticsTransformation' 213 | 'New-AzTrafficManagerEndpoint' 214 | 'New-AzTrafficManagerProfile' 215 | 'New-AzVirtualNetwork' 216 | 'New-AzVirtualNetworkGateway' 217 | 'New-AzVirtualNetworkGatewayConnection' 218 | 'New-AzVM' 219 | 'New-AzWebApp' 220 | 'New-AzureVMSqlServerAutoBackupConfig' 221 | 'Publish-AzAutomationRunbook' 222 | 'Publish-AzVMDscConfiguration' 223 | 'Register-AzAutomationDscNode' 224 | 'Register-AzAutomationScheduledRunbook' 225 | 'Register-AzBackupContainer' 226 | 'Remove-AzApiManagement' 227 | 'Remove-AzApplicationGateway' 228 | 'Remove-AzAppServicePlan' 229 | 'Remove-AzAutomationAccount' 230 | 'Remove-AzAutomationCertificate' 231 | 'Remove-AzAutomationConnection' 232 | 'Remove-AzAutomationCredential' 233 | 'Remove-AzAutomationModule' 234 | 'Remove-AzAutomationRunbook' 235 | 'Remove-AzAutomationSchedule' 236 | 'Remove-AzAutomationVariable' 237 | 'Remove-AzAutomationWebhook' 238 | 'Remove-AzAvailabilitySet' 239 | 'Remove-AzBatchAccount' 240 | 'Remove-AzDataFactory' 241 | 'Remove-AzDataFactoryDataset' 242 | 'Remove-AzDataFactoryGateway' 243 | 'Remove-AzDataFactoryHub' 244 | 'Remove-AzDataFactoryLinkedService' 245 | 'Remove-AzDataFactoryPipeline' 246 | 'Remove-AzDnsRecordSet' 247 | 'Remove-AzDnsZone' 248 | 'Remove-AzHDInsightCluster' 249 | 'Remove-AzKeyVault' 250 | 'Remove-AzKeyVaultAccessPolicy' 251 | 'Remove-AzLoadBalancer' 252 | 'Remove-AzLocalNetworkGateway' 253 | 'Remove-AzNetworkInterface' 254 | 'Remove-AzNetworkSecurityGroup' 255 | 'Remove-AzOperationalInsightsStorageInsight' 256 | 'Remove-AzOperationalInsightsWorkspace' 257 | 'Remove-AzPublicIpAddress' 258 | 'Remove-AzRedisCache' 259 | 'Remove-AzResource' 260 | 'Remove-AzResourceGroup' 261 | 'Remove-AzResourceGroupDeployment' 262 | 'Remove-AzResourceLock' 263 | 'Remove-AzRoleAssignment' 264 | 'Remove-AzRouteTable' 265 | 'Remove-AzSqlDatabase' 266 | 'Remove-AzSqlDatabaseAuditing' 267 | 'Remove-AzSqlDatabaseDataMaskingRule' 268 | 'Remove-AzSqlDatabaseSecondary' 269 | 'Remove-AzSqlElasticPool' 270 | 'Remove-AzSqlServer' 271 | 'Remove-AzSqlServerActiveDirectoryAdministrator' 272 | 'Remove-AzSqlServerAuditing' 273 | 'Remove-AzSqlServerFirewallRule' 274 | 'Remove-AzStorageAccount' 275 | 'Remove-AzStreamAnalyticsInput' 276 | 'Remove-AzStreamAnalyticsJob' 277 | 'Remove-AzStreamAnalyticsOutput' 278 | 'Remove-AzTrafficManagerEndpoint' 279 | 'Remove-AzTrafficManagerProfile' 280 | 'Remove-AzVirtualNetwork' 281 | 'Remove-AzVirtualNetworkGateway' 282 | 'Remove-AzVirtualNetworkGatewayConnection' 283 | 'Remove-AzVM' 284 | 'Remove-AzVMAccessExtension' 285 | 'Remove-AzVMCustomScriptExtension' 286 | 'Remove-AzVMDiagnosticsExtension' 287 | 'Remove-AzVMDscExtension' 288 | 'Remove-AzVMExtension' 289 | 'Remove-AzVMSqlServerExtension' 290 | 'Remove-AzWebApp' 291 | 'Reset-AzVirtualNetworkGatewayConnectionSharedKey' 292 | 'Restart-AzVM' 293 | 'Restart-AzWebApp' 294 | 'Restore-AzApiManagement' 295 | 'Resume-AzAutomationJob' 296 | 'Resume-AzDataFactoryPipeline' 297 | 'Resume-AzSqlDatabase' 298 | 'Revoke-AzHDInsightHttpServicesAccess' 299 | 'Revoke-AzHDInsightRdpServicesAccess' 300 | 'Save-AzDataFactoryLog' 301 | 'Save-AzVMImage' 302 | 'Set-AzApiManagementHostnames' 303 | 'Set-AzApiManagementVirtualNetworks' 304 | 'Set-AzAppServicePlan' 305 | 'Set-AzAutomationAccount' 306 | 'Set-AzAutomationCertificate' 307 | 'Set-AzAutomationConnectionFieldValue' 308 | 'Set-AzAutomationCredential' 309 | 'Set-AzAutomationDscNode' 310 | 'Set-AzAutomationModule' 311 | 'Set-AzAutomationRunbook' 312 | 'Set-AzAutomationSchedule' 313 | 'Set-AzAutomationVariable' 314 | 'Set-AzAutomationWebhook' 315 | 'Set-AzBatchAccount' 316 | 'Set-AzDataFactoryGateway' 317 | 'Set-AzDataFactoryPipelineActivePeriod' 318 | 'Set-AzDataFactorySliceStatus' 319 | 'Set-AzDnsZone' 320 | 'Set-AzHDInsightClusterSize' 321 | 'Set-AzKeyVaultAccessPolicy' 322 | 'Set-AzOperationalInsightsStorageInsight' 323 | 'Set-AzOperationalInsightsWorkspace' 324 | 'Set-AzRedisCache' 325 | 'Set-AzResource' 326 | 'Set-AzResourceGroup' 327 | 'Set-AzResourceLock' 328 | 'Set-AzSqlDatabase' 329 | 'Set-AzSqlDatabaseAuditingPolicy' 330 | 'Set-AzSqlDatabaseDataMaskingPolicy' 331 | 'Set-AzSqlDatabaseDataMaskingRule' 332 | 'Set-AzSqlDatabaseSecondary' 333 | 'Set-AzSqlDatabaseTransparentDataEncryption' 334 | 'Set-AzSqlElasticPool' 335 | 'Set-AzSqlServer' 336 | 'Set-AzSqlServerActiveDirectoryAdministrator' 337 | 'Set-AzSqlServerAuditingPolicy' 338 | 'Set-AzSqlServerFirewallRule' 339 | 'Set-AzStorageAccount' 340 | 'Set-AzVirtualNetworkGatewayConnectionSharedKey' 341 | 'Set-AzVM' 342 | 'Set-AzVMAccessExtension' 343 | 'Set-AzVMCustomScriptExtension' 344 | 'Set-AzVMDiagnosticsExtension' 345 | 'Set-AzVMDscExtension' 346 | 'Set-AzVMExtension' 347 | 'Set-AzVMSqlServerExtension' 348 | 'Start-AzAutomationDscCompilationJob' 349 | 'Start-AzAutomationRunbook' 350 | 'Start-AzHDInsightJob' 351 | 'Start-AzSqlDatabaseExecuteIndexRecommendation' 352 | 'Start-AzSqlServerUpgrade' 353 | 'Start-AzStreamAnalyticsJob' 354 | 'Start-AzVM' 355 | 'Start-AzWebApp' 356 | 'Stop-AzAutomationJob' 357 | 'Stop-AzHDInsightJob' 358 | 'Stop-AzResourceGroupDeployment' 359 | 'Stop-AzSqlDatabaseExecuteIndexRecommendation' 360 | 'Stop-AzSqlServerUpgrade' 361 | 'Stop-AzStreamAnalyticsJob' 362 | 'Stop-AzVM' 363 | 'Stop-AzWebApp' 364 | 'Suspend-AzAutomationJob' 365 | 'Suspend-AzDataFactoryPipeline' 366 | 'Suspend-AzSqlDatabase' 367 | 'Test-AzResource' 368 | 'Test-AzResourceGroup' 369 | 'Test-AzResourceGroupTemplate' 370 | 'Test-AzStreamAnalyticsInput' 371 | 'Test-AzStreamAnalyticsOutput' 372 | 'Unregister-AzAutomationDscNode' 373 | 'Unregister-AzAutomationScheduledRunbook' 374 | 'Update-AzApiManagementDeployment' 375 | 'Update-AzVM' 376 | 'Use-AzHDInsightCluster' 377 | 'Use-AzSqlServerAuditingPolicy' 378 | 'Wait-AzHDInsightJob' 379 | ); 380 | ParameterName = 'ResourceGroupName'; 381 | #Description = 'Complete the -ResourceGroupName parameter value for Azure Resource Manager cmdlets: New-AzureVM -ResourceGroupName '; 382 | ScriptBlock = $ScriptBlock; 383 | } 384 | 385 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; 386 | 387 | $ArgumentCompleter = @{ 388 | CommandName = @( 389 | 'Find-AzResourceGroup' 390 | 'Get-AzResourceGroup' 391 | 'New-AzResourceGroup' 392 | 'Remove-AzResourceGroup' 393 | 'Set-AzResourceGroup' 394 | ); 395 | ParameterName = 'Name'; 396 | #Description = 'Complete the -Name parameter value for the core Azure Resource Manager (ARM) Resource Group cmdlets: Get-AzureRmResourceGroup -Name '; 397 | ScriptBlock = $ScriptBlock; 398 | } 399 | 400 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; -------------------------------------------------------------------------------- /Completers/Microsoft.Az.ResourceLocks.Name.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ArgumentCompleter = @{ 2 | CommandName = @( 3 | 'Get-AzResourceLock', 4 | 'New-AzResourceLock', 5 | 'Remove-AzResourceLock', 6 | 'Set-AzResourceLock' 7 | ); 8 | ParameterName = 'LockName'; 9 | ScriptBlock = { 10 | <# 11 | .SYNOPSIS 12 | Auto-complete the -LockName parameter value for Azure Resource Manager (ARM) cmdlets. 13 | 14 | .NOTES 15 | Created by Trevor Sullivan 16 | http://trevorsullivan.net 17 | http://twitter.com/pcgeek86 18 | #> 19 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 20 | 21 | ### Create fresh completion results for Azure virtual machines 22 | $ItemList = Get-AzResourceLock | Where-Object { $PSItem.Name -match $wordToComplete } | ForEach-Object { 23 | $CompletionText = '{0} -ResourceGroupName {1}' -f $PSItem.Name, $PSItem.ResourceGroupName; 24 | $ToolTip = 'Lock named {0} applied to Resource Group {1}' -f $PSItem.ResourceName, $PSItem.ResourceGroupName; 25 | $ListItemText = '{0} ({1})' -f $PSItem.Name, $PSItem.ResourceGroupName; 26 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 27 | 28 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 29 | } 30 | 31 | ### Return the completion results 32 | return $ItemList; 33 | } 34 | } 35 | 36 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; -------------------------------------------------------------------------------- /Completers/Microsoft.Az.Resources.ResourceId.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ScriptBlock = { 2 | <# 3 | .SYNOPSIS 4 | Auto-complete the -ResourceId parameter value for Azure Resource Manager (ARM) PowerShell cmdlets. 5 | 6 | .NOTES 7 | Created by Trevor Sullivan 8 | http://trevorsullivan.net 9 | #> 10 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 11 | 12 | try { 13 | $ObjectList = Get-AzResource -ErrorAction Stop -WarningAction Ignore; 14 | } catch { 15 | Write-Host -Object ('Error occurred retrieving Automation Accounts: {0}' -f $PSItem.Exception.Message); 16 | } 17 | $ItemList = $ObjectList | Where-Object { $PSItem.AutomationAccountName -match $wordToComplete } | ForEach-Object { 18 | $CompletionText = $PSItem.ResourceId; 19 | $ToolTip = 'Resource {0} in {1} region, in {2} Resource Group.' -f $PSItem.ResourceName, $PSItem.Location, $PSItem.ResourceGroupName; 20 | $ListItemText = '{0} ({1})' -f $PSItem.ResourceName, $PSItem.Location; 21 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 22 | 23 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 24 | } 25 | 26 | return $ItemList 27 | } 28 | $ArgumentCompleter = @{ 29 | ### NOTE: Use this command to generate command list: 30 | ### (Get-Command -Module Az* -ParameterName ResourceId).Name.ForEach({ "'{0}'," -f $PSItem }) | Set-Clipboard 31 | CommandName = @( 32 | 'Get-AzAlertHistory', 33 | 'Get-AzAutoscaleHistory', 34 | 'Get-AzDiagnosticSetting', 35 | 'Get-AzLog', 36 | 'Get-AzMetric', 37 | 'Get-AzMetricDefinition', 38 | 'Get-AzPolicyAssignment', 39 | 'Get-AzPolicyDefinition', 40 | 'Get-AzResource', 41 | 'Get-AzResourceGroup', 42 | 'Get-AzResourceGroupDeployment', 43 | 'Get-AzResourceLock', 44 | 'Get-AzUsage', 45 | 'Invoke-AzResourceAction', 46 | 'Move-AzResource', 47 | 'New-AzResource', 48 | 'New-AzResourceLock', 49 | 'Remove-AzPolicyAssignment', 50 | 'Remove-AzPolicyDefinition', 51 | 'Remove-AzResource', 52 | 'Remove-AzResourceGroup', 53 | 'Remove-AzResourceGroupDeployment', 54 | 'Remove-AzResourceLock', 55 | 'Set-AzDiagnosticSetting', 56 | 'Set-AzPolicyAssignment', 57 | 'Set-AzPolicyDefinition', 58 | 'Set-AzResource', 59 | 'Set-AzResourceGroup', 60 | 'Set-AzResourceLock', 61 | 'Stop-AzResourceGroupDeployment' 62 | ); 63 | ParameterName = 'ResourceId'; 64 | ScriptBlock = $ScriptBlock; 65 | } 66 | 67 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; 68 | -------------------------------------------------------------------------------- /Completers/Microsoft.Az.Resources.ResourceType.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ArgumentCompleter = @{ 2 | ### Refresh this list of commands, using this command: 3 | ### (Get-Command -ParameterName ResourceType).Name.ForEach({ "'{0}'," -f $PSItem }) | Set-Clipboard 4 | CommandName = @( 5 | 'Find-AzResource', 6 | 'Get-AzResource', 7 | 'Get-AzResourceLock', 8 | 'Get-AzRoleAssignment', 9 | 'Invoke-AzResourceAction', 10 | 'New-AzResource', 11 | 'New-AzResourceLock', 12 | 'New-AzRoleAssignment', 13 | 'Remove-AzResource', 14 | 'Remove-AzResourceLock', 15 | 'Remove-AzRoleAssignment', 16 | 'Set-AzResource', 17 | 'Set-AzResourceLock' 18 | ); 19 | ParameterName = 'ResourceType'; 20 | ScriptBlock = { 21 | <# 22 | .SYNOPSIS 23 | Auto-complete the -ResourceType parameter value for Azure Resource Manager (ARM) cmdlets. 24 | 25 | .NOTES 26 | Created by Trevor Sullivan 27 | http://trevorsullivan.net 28 | http://twitter.com/pcgeek86 29 | #> 30 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 31 | 32 | ### Helper function to find an authoritative list of all Azure Resource Manager (ARM) Resource Types 33 | function Get-AllARMResourceTypes { 34 | [CmdletBinding()] 35 | param ( ) 36 | $ResourceProviderList = Get-AzResourceProvider -ListAvailable -WarningAction Ignore; 37 | 38 | foreach ($ResourceProvider in $ResourceProviderList) { 39 | foreach ($ResourceType in $ResourceProvider.ResourceTypes) { 40 | '{0}/{1}' -f $ResourceProvider.ProviderNamespace, $ResourceType.ResourceTypeName; 41 | } 42 | } 43 | } 44 | 45 | ### Create fresh completion results for Azure virtual machines 46 | $ItemList = Get-AllARMResourceTypes | Where-Object { $PSItem -match $wordToComplete } | ForEach-Object { 47 | $CompletionText = '{0}' -f $PSItem; 48 | $ToolTip = '{0}' -f $PSItem; 49 | $ListItemText = '{0}' -f $PSItem; 50 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 51 | 52 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 53 | } 54 | 55 | ### Return the completion results 56 | return $ItemList; 57 | } 58 | } 59 | 60 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; -------------------------------------------------------------------------------- /Completers/Microsoft.Az.SQL.CollationName.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ScriptBlock = { 2 | <# 3 | .SYNOPSIS 4 | Auto-complete the -CollationName parameter value for Azure Resource Manager (ARM) PowerShell cmdlets. 5 | 6 | .NOTES 7 | Created by Trevor Sullivan 8 | https://trevorsullivan.net 9 | #> 10 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 11 | 12 | $ObjectList = @( 13 | @{ Name = 'SQL_Latin1_General_Cp437_CS_AS_KI_WI'; Description = 'Dictionary order, case-sensitive'; } 14 | @{ Name = 'SQL_Latin1_General_Cp437_CI_AS_KI_WI'; Description = 'Dictionary order, case-insensitive'; } 15 | @{ Name = 'SQL_Latin1_General_Pref_Cp437_CI_AS_KI_WI'; Description = 'Dictionary order, case-insensitive, uppercase preference'; } 16 | @{ Name = 'SQL_Latin1_General_Cp437_CI_AI_KI_WI'; Description = 'Dictionary order, case-insensitive, accent-insensitive'; } 17 | @{ Name = 'SQL_Latin1_General_Cp437_BIN'; Description = 'Binary'; } 18 | @{ Name = 'SQL_Latin1_General_Cp850_BIN'; Description = 'Binary'; } 19 | @{ Name = 'SQL_Latin1_General_Cp850_CS_AS_KI_WI'; Description = 'Dictionary order, case-sensitive'; } 20 | @{ Name = 'SQL_Latin1_General_Cp850_CI_AS_KI_WI'; Description = 'Dictionary order, case-insensitive'; } 21 | @{ Name = 'SQL_Latin1_General_Cp850_CI_AI_KI_WI'; Description = 'Dictionary order, case-insensitive, accent-insensitive'; } 22 | @{ Name = 'SQL_Latin1_General_Pref_Cp850_CI_AS_KI_WI'; Description = 'Dictionary order, case-insensitive, uppercase preference'; } 23 | @{ Name = 'SQL_1xCompat_Cp850_CI_AS_KI_WI'; Description = 'Strict compatibility with Version 1.x case-insensitive databases'; } 24 | @{ Name = 'SQL_Latin1_General_Cp1_CS_AS_KI_WI'; Description = 'Dictionary order, case-sensitive'; } 25 | @{ Name = 'SQL_Latin1_General_Cp1_CI_AS_KI_WI'; Description = 'Dictionary order, case-insensitive'; } 26 | @{ Name = 'SQL_Latin1_General_Pref_Cp1_CI_AS_KI_WI'; Description = 'Dictionary order, case-insensitive, uppercase preference'; } 27 | @{ Name = 'SQL_Latin1_General_Cp1_CI_AI_KI_WI'; Description = 'Dictionary order, case-insensitive, accent-insensitive'; } 28 | @{ Name = 'SQL_AltDiction_Cp850_CS_AS_KI_WI'; Description = 'Alternate dictionary order, case-sensitive'; } 29 | @{ Name = 'SQL_AltDiction_Pref_Cp850_CI_AS_KI_WI'; Description = 'Alternate dictionary order, case-insensitive, uppercase preference'; } 30 | @{ Name = 'SQL_AltDiction_Cp850_CI_AI_KI_WI'; Description = 'Alternate dictionary order, case-insensitive, accent-insensitive'; } 31 | @{ Name = 'SQL_Scandainavian_Pref_Cp850_CI_AS_KI_WI'; Description = 'Scandinavian dictionary sort order, case-insensitive, uppercase preference'; } 32 | @{ Name = 'SQL_Scandainavian_Cp850_CS_AS_KI_WI'; Description = 'Scandinavian dictionary sort order, case-sensitive'; } 33 | @{ Name = 'SQL_Scandainavian_Cp850_CI_AS_KI_WI'; Description = 'Case-insensitive Scandinavian dictionary sort order, without case preference'; } 34 | @{ Name = 'SQL_AltDiction_Cp850_CI_AS_KI_WI'; Description = 'Alternate dictionary order, case-insensitive'; } 35 | @{ Name = 'SQL_Latin1_General_1250_BIN'; Description = 'Binary'; } 36 | @{ Name = 'SQL_Latin1_General_Cp1250_CS_AS_KI_WI'; Description = 'Dictionary order, case-sensitive'; } 37 | @{ Name = 'SQL_Latin1_General_Cp1250_CI_AS_KI_WI'; Description = 'Dictionary order, case-insensitive'; } 38 | @{ Name = 'SQL_Czech_Cp1250_CS_AS_KI_WI'; Description = 'Czech dictionary order, case-sensitive'; } 39 | @{ Name = 'SQL_Czech_Cp1250_CI_AS_KI_WI'; Description = 'Czech dictionary order, case-insensitive'; } 40 | @{ Name = 'SQL_Hungarian_Cp1250_CS_AS_KI_WI'; Description = 'Hungarian dictionary order, case-sensitive'; } 41 | @{ Name = 'SQL_Hungarian_Cp1250_CI_AS_KI_WI'; Description = 'Hungarian dictionary order, case-insensitive'; } 42 | @{ Name = 'SQL_Polish_Cp1250_CS_AS_KI_WI'; Description = 'Polish dictionary order, case-sensitive'; } 43 | @{ Name = 'SQL_Polish_Cp1250_CI_AS_KI_WI'; Description = 'Polish dictionary order, case-insensitive'; } 44 | @{ Name = 'SQL_Romanian_Cp1250_CS_AS_KI_WI'; Description = 'Romanian dictionary order, case-sensitive'; } 45 | @{ Name = 'SQL_Romanian_Cp1250_CI_AS_KI_WI'; Description = 'Romanian dictionary order, case-insensitive'; } 46 | @{ Name = 'SQL_Croatian_Cp1250_CS_AS_KI_WI'; Description = 'Croatian dictionary order, case-sensitive'; } 47 | @{ Name = 'SQL_Croatian_Cp1250_CI_AS_KI_WI'; Description = 'Croatian dictionary order, case-insensitive'; } 48 | @{ Name = 'SQL_Slovak_Cp1250_CS_AS_KI_WI'; Description = 'Slovak dictionary order, case-sensitive'; } 49 | @{ Name = 'SQL_Slovak_Cp1250_CI_AS_KI_WI'; Description = 'Slovak dictionary order, case-insensitive'; } 50 | @{ Name = 'SQL_Slovenian_Cp1250_CS_AS_KI_WI'; Description = 'Slovenian dictionary order, case-sensitive'; } 51 | @{ Name = 'SQL_Slovenian_Cp1250_CI_AS_KI_WI'; Description = 'Slovenian dictionary order, case-insensitive'; } 52 | @{ Name = 'SQL_Latin1_General_1251_BIN'; Description = 'Binary'; } 53 | @{ Name = 'SQL_Latin1_General_Cp1251_CS_AS_KI_WI'; Description = 'Dictionary order, case-sensitive'; } 54 | @{ Name = 'SQL_Latin1_General_Cp1251_CI_AS_KI_WI'; Description = 'Dictionary order, case-insensitive'; } 55 | @{ Name = 'SQL_Ukrainian_Cp1251_CS_AS_KI_WI'; Description = 'Ukrainian dictionary order, case-sensitive'; } 56 | @{ Name = 'SQL_Ukrainian_Cp1251_CI_AS_KI_WI'; Description = 'Ukrainian dictionary order, case-insensitive'; } 57 | @{ Name = 'SQL_Latin1_General_1253_BIN'; Description = 'Binary'; } 58 | @{ Name = 'SQL_Latin1_General_Cp1253_CS_AS_KI_WI'; Description = 'Dictionary order, case-sensitive'; } 59 | @{ Name = 'SQL_Latin1_General_Cp1253_CI_AS_KI_WI'; Description = 'Dictionary order, case-insensitive'; } 60 | @{ Name = 'SQL_Latin1_General_Cp1253_CI_AS_KI_WI'; Description = 'Dictionary order, case-sensitive, accent-sensitive'; } 61 | @{ Name = 'SQL_Latin1_General_Cp1253_CI_AI_KI_WI'; Description = 'Dictionary order, case-insensitive, accent-insensitive'; } 62 | @{ Name = 'SQL_Latin1_General_1254_BIN'; Description = 'Binary'; } 63 | @{ Name = 'SQL_Latin1_General_Cp1254_CS_AS_KI_WI'; Description = 'Dictionary order, case-sensitive'; } 64 | @{ Name = 'SQL_Latin1_General_Cp1254_CI_AS_KI_WI'; Description = 'Dictionary order, case-insensitive'; } 65 | @{ Name = 'SQL_Latin1_General_1255_BIN'; Description = 'Binary'; } 66 | @{ Name = 'SQL_Latin1_General_Cp1255_CS_AS_KI_WI'; Description = 'Dictionary order, case-sensitive'; } 67 | @{ Name = 'SQL_Latin1_General_Cp1255_CI_AS_KI_WI'; Description = 'Dictionary order, case-insensitive'; } 68 | @{ Name = 'SQL_Latin1_General_1256_BIN'; Description = 'Binary'; } 69 | @{ Name = 'SQL_Latin1_General_Cp1256_CS_AS_KI_WI'; Description = 'Dictionary order, case-sensitive'; } 70 | @{ Name = 'SQL_Latin1_General_Cp1256_CI_AS_KI_WI'; Description = 'Dictionary order, case-insensitive'; } 71 | @{ Name = 'SQL_Latin1_General_1257_BIN'; Description = 'Binary'; } 72 | @{ Name = 'SQL_Latin1_General_Cp1257_CS_AS_KI_WI'; Description = 'Dictionary order, case-sensitive'; } 73 | @{ Name = 'SQL_Latin1_General_Cp1257_CI_AS_KI_WI'; Description = 'Dictionary order, case-insensitive'; } 74 | @{ Name = 'SQL_Estonian_Cp1257_CS_AS_KI_WI'; Description = 'Estonian dictionary order, case-sensitive'; } 75 | @{ Name = 'SQL_Estonian_Cp1257_CI_AS_KI_WI'; Description = 'Estonian dictionary order, case-insensitive'; } 76 | @{ Name = 'SQL_Latvian_Cp1257_CS_AS_KI_WI'; Description = 'Latvian dictionary order, case-sensitive'; } 77 | @{ Name = 'SQL_Latvian_Cp1257_CI_AS_KI_WI'; Description = 'Latvian dictionary order, case-insensitive'; } 78 | @{ Name = 'SQL_Lithuanian_Cp1257_CS_AS_KI_WI'; Description = 'Lithuanian dictionary order, case-sensitive'; } 79 | @{ Name = 'SQL_Lithuanian_Cp1257_CI_AS_KI_WI'; Description = 'Lithuanian dictionary order, case-insensitive'; } 80 | @{ Name = 'SQL_Danish_Pref_Cp1_CI_AS_KI_WI'; Description = 'Danish/Norwegian dictionary order, case-insensitive, uppercase preference'; } 81 | @{ Name = 'SQL_SwedishPhone_Pref_Cp1_CI_AS_KI_WI'; Description = 'Swedish/Finnish[Phone] dictionary order, case-insensitive, uppercase preference'; } 82 | @{ Name = 'SQL_SwedishStd_Pref_Cp1_CI_AS_KI_WI'; Description = 'Swedish/Finnish[Std] dictionary order, case-insensitive, uppercase preference'; } 83 | @{ Name = 'SQL_Icelandic_Pref_Cp1_CI_AS_KI_WI'; Description = 'Icelandic dictionary order, case-insensitive, uppercase preference'; } 84 | ) 85 | 86 | $ItemList = $ObjectList | Where-Object { $PSItem.Name -match $wordToComplete } | ForEach-Object { 87 | $CompletionText = $PSItem.Name; 88 | $ToolTip = $PSItem.Description; 89 | $ListItemText = $PSItem.Name; 90 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 91 | 92 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 93 | } 94 | 95 | return $ItemList 96 | } 97 | 98 | $ArgumentCompleter = @{ 99 | CommandName = @( 100 | 'New-AzSqlDatabase' 101 | ); 102 | ParameterName = 'CollationName'; 103 | ScriptBlock = $ScriptBlock; 104 | } 105 | 106 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; 107 | -------------------------------------------------------------------------------- /Completers/Microsoft.Az.Storage.StorageAccountName.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ScriptBlock = { 2 | <# 3 | .SYNOPSIS 4 | Auto-complete the -StorageAccountName parameter value for Azure Resource Manager (ARM) PowerShell cmdlets. 5 | 6 | .NOTES 7 | 8 | Created by Trevor Sullivan 9 | http://trevorsullivan.net 10 | #> 11 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 12 | 13 | try { 14 | $StorageAccountList = Get-AzStorageAccount | Where-Object -FilterScript { $PSItem.StorageAccountName -match $wordToComplete } | ForEach-Object { 15 | $CompletionText = '{0} -ResourceGroupName {1}' -f $PSItem.StorageAccountName, $PSItem.ResourceGroupName; 16 | $ToolTip = 'Storage Account "{0}" in "{1}" region.' -f $PSItem.StorageAccountName, $PSItem.Location; 17 | $ListItemText = '{0} ({1})' -f $PSItem.StorageAccountName, $PSItem.Location; 18 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 19 | 20 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 21 | } 22 | 23 | return $StorageAccountList; 24 | } 25 | catch { 26 | Write-Host -Message ('Error occurred calling argument completer: {0}' -f $PSItem.Exception.Message); 27 | } 28 | }; 29 | 30 | $ArgumentCompleterList = @( 31 | @{ 32 | CommandName = @( 33 | 'Add-AzHDInsightStorage' 34 | 'New-AzResourceGroup' 35 | 'New-AzResourceGroupDeployment' 36 | 'New-AzStorageContext' 37 | 'Publish-AzVMDscConfiguration' 38 | 'Remove-AzStorageAccount' 39 | 'Restore-AzBackupItem' 40 | 'Set-AzHDInsightDefaultStorage' 41 | 'Set-AzSqlDatabaseAuditingPolicy' 42 | 'Set-AzSqlServerAuditingPolicy' 43 | 'Set-AzVMCustomScriptExtension' 44 | 'Set-AzVMDscExtension' 45 | 'Test-AzResourceGroupTemplate' 46 | ); 47 | ParameterName = 'StorageAccountName'; 48 | ScriptBlock = $ScriptBlock; 49 | }; 50 | @{ 51 | CommandName = @( 52 | 'Get-AzStorageAccountKey' 53 | 'New-AzStorageAccountKey' 54 | 'Get-AzStorageAccount' 55 | 'New-AzStorageAccount' 56 | 'Set-AzStorageAccount' 57 | 'Remove-AzStorageAccount' 58 | ); 59 | ParameterName = 'Name'; 60 | ScriptBlock = $ScriptBlock; 61 | } 62 | ) 63 | 64 | foreach ($ArgumentCompleter in $ArgumentCompleterList) { 65 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; 66 | } -------------------------------------------------------------------------------- /Completers/Microsoft.Az.Subscription.SubscriptionName.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ArgumentCompleter = @{ 2 | ### (Get-Command -Module Az* -ParameterName SubscriptionName -Type Cmdlet).Name.ForEach({ "'{0}'," -f $PSItem }) | Set-Clipboard; 3 | CommandName = @( 4 | 'Add-AzAccount', 5 | 'Get-AzSubscription', 6 | 'Set-AzContext' 7 | ); 8 | ParameterName = 'SubscriptionName'; 9 | ScriptBlock = { 10 | <# 11 | .SYNOPSIS 12 | Auto-complete the -SubscriptionName parameter value for Azure Resource Manager (ARM) PowerShell cmdlets. 13 | 14 | .NOTES 15 | Created by Trevor Sullivan 16 | http://trevorsullivan.net 17 | #> 18 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 19 | 20 | $ErrorActionPreference = 'Stop'; 21 | 22 | try { 23 | $ItemList = Get-AzSubscription | Where-Object { $PSItem.SubscriptionName -match $wordToComplete } | ForEach-Object { 24 | $CompletionText = $PSItem.SubscriptionName; 25 | $ToolTip = 'Azure subscription "{0}" with ID {1}.' -f $PSItem.SubscriptionName, $PSItem.SubscriptionId; 26 | $ListItemText = '{0} ({1})' -f $PSItem.SubscriptionName, $PSItem.SubscriptionId; 27 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 28 | 29 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 30 | } 31 | 32 | return $ItemList 33 | } catch { 34 | $LogPath = '{0}\AzureExt.log' -f $env:TEMP; 35 | Add-Content -Path $LogPath -Value ('{0}: Exception occurred' -f $PSItem.Exception.Message); 36 | } 37 | } 38 | } 39 | 40 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; 41 | -------------------------------------------------------------------------------- /Completers/Microsoft.Az.VirtualMachine.VMName.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ScriptBlock = { 2 | <# 3 | .SYNOPSIS 4 | Auto-complete the -StorageAccountName parameter value for Azure Resource Manager (ARM) PowerShell cmdlets. 5 | 6 | .NOTES 7 | 8 | Created by Trevor Sullivan 9 | http://trevorsullivan.net 10 | #> 11 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 12 | 13 | try { 14 | $StorageAccountList = Get-AzVm | Where-Object -FilterScript { $PSItem.Name -match $wordToComplete } | ForEach-Object { 15 | $CompletionText = '{0} -ResourceGroupName {1}' -f $PSItem.Name, $PSItem.ResourceGroupName; 16 | $ToolTip = 'Virtual Machine "{0}" in "{1}" region.' -f $PSItem.Name, $PSItem.Location; 17 | $ListItemText = '{0} ({1})' -f $PSItem.Name, $PSItem.Location; 18 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 19 | 20 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 21 | } 22 | 23 | return $StorageAccountList; 24 | } 25 | catch { 26 | Write-Host -Message ('Error occurred calling argument completer: {0}' -f $PSItem.Exception.Message); 27 | } 28 | }; 29 | 30 | $ArgumentCompleterList = @( 31 | @{ 32 | CommandName = @( 33 | 'Add-AzVMAdditionalUnattendContent' 34 | 'Add-AzVMDataDisk' 35 | 'Add-AzVMNetworkInterface' 36 | 'Add-AzVMSecret' 37 | 'Add-AzVMSshPublicKey' 38 | 'Get-AzVM' 39 | 'Get-AzVMAccessExtension' 40 | 'Get-AzVMBootDiagnosticsData' 41 | 'Get-AzVMCustomScriptExtension' 42 | 'Get-AzVMDiagnosticsExtension' 43 | 'Get-AzVMDiskEncryptionStatus' 44 | 'Get-AzVMDscExtension' 45 | 'Get-AzVMDscExtensionStatus' 46 | 'Get-AzVMExtension' 47 | 'Get-AzVmExtensionImage' 48 | 'Get-AzVMExtensionImageType' 49 | 'Get-AzVMImage' 50 | 'Get-AzVMImageOffer' 51 | 'Get-AzVMImagePublisher' 52 | 'Get-AzVMImageSku' 53 | 'Get-AzVMSize' 54 | 'Get-AzVMSqlServerExtension' 55 | 'Get-AzVMUsage' 56 | 'New-AzVM' 57 | 'New-AzVMConfig' 58 | 'Publish-AzVMDscConfiguration' 59 | 'Remove-AzVM' 60 | 'Remove-AzVMAccessExtension' 61 | 'Remove-AzVMBackup' 62 | 'Remove-AzVMCustomScriptExtension' 63 | 'Remove-AzVMDataDisk' 64 | 'Remove-AzVMDiagnosticsExtension' 65 | 'Remove-AzVMDiskEncryptionExtension' 66 | 'Remove-AzVMDscExtension' 67 | 'Remove-AzVMExtension' 68 | 'Remove-AzVMNetworkInterface' 69 | 'Remove-AzVMSqlServerExtension' 70 | 'Restart-AzVM' 71 | 'Save-AzVMImage' 72 | 'Set-AzVM' 73 | 'Set-AzVMAccessExtension' 74 | 'Set-AzVMBackupExtension' 75 | 'Set-AzVMBootDiagnostics' 76 | 'Set-AzVMCustomScriptExtension' 77 | 'Set-AzVMDataDisk' 78 | 'Set-AzVMDiagnosticsExtension' 79 | 'Set-AzVMDiskEncryptionExtension' 80 | 'Set-AzVMDscExtension' 81 | 'Set-AzVMExtension' 82 | 'Set-AzVMOperatingSystem' 83 | 'Set-AzVMOSDisk' 84 | 'Set-AzVMSourceImage' 85 | 'Set-AzVMSqlServerExtension' 86 | 'Start-AzVM' 87 | 'Stop-AzVM' 88 | 'Update-AzVM' 89 | 'Invoke-AzRemoteDesktop' 90 | ); 91 | ParameterName = 'Name'; 92 | ScriptBlock = $ScriptBlock; 93 | }; 94 | ) 95 | 96 | foreach ($ArgumentCompleter in $ArgumentCompleterList) { 97 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; 98 | } 99 | -------------------------------------------------------------------------------- /Completers/Microsoft.Az.VirtualNetwork.Name.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ScriptBlock = { 2 | <# 3 | .SYNOPSIS 4 | Auto-complete the -Name parameter value for Azure Resource Manager (ARM) PowerShell cmdlets for Virtual Networking. 5 | 6 | .NOTES 7 | 8 | Created by Trevor Sullivan 9 | http://trevorsullivan.net 10 | #> 11 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 12 | 13 | try { 14 | $CompletionList = Get-AzVirtualNetwork | Where-Object -FilterScript { $PSItem.Name -match $wordToComplete } | ForEach-Object { 15 | $CompletionText = '{0} -ResourceGroupName {1}' -f $PSItem.Name, $PSItem.ResourceGroupName; 16 | $ToolTip = 'Virtual Network "{0}" in "{1}" region, member of "{2}" Resource Group.' -f $PSItem.Name, $PSItem.Location, $PSItem.ResourceGroup; 17 | $ListItemText = '{1} ({0}, {2})' -f $PSItem.ResourceGroupName, $PSItem.Name, $PSItem.Location; 18 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 19 | 20 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 21 | } 22 | 23 | return $CompletionList; 24 | } 25 | catch { 26 | Write-Host -Message ('Error occurred calling argument completer: {0}' -f $PSItem.Exception.Message); 27 | } 28 | }; 29 | 30 | $ArgumentCompleterList = @( 31 | @{ 32 | CommandName = @( 33 | 'Get-AzLocalNetworkGateway' 34 | 'Get-AzVirtualNetwork' 35 | 'Get-AzVirtualNetworkGateway' 36 | 'Get-AzVirtualNetworkGatewayConnection' 37 | 'Get-AzVirtualNetworkGatewayConnectionSharedKey' 38 | 'New-AzVirtualNetwork' 39 | 'New-AzVirtualNetworkGateway' 40 | 'New-AzVirtualNetworkGatewayConnection' 41 | 'New-AzVirtualNetworkSubnetConfig' 42 | 'Remove-AzVirtualNetwork' 43 | 'Remove-AzVirtualNetworkGateway' 44 | 'Remove-AzVirtualNetworkGatewayConnection' 45 | 'Reset-AzVirtualNetworkGatewayConnectionSharedKey' 46 | 'Set-AzVirtualNetworkGatewayConnectionSharedKey' 47 | ); 48 | ParameterName = 'Name'; 49 | #Description = 'Complete the -Name parameter value for Azure Resource Manager (ARM) Virtual Network cmdlets: Get-AzVirtualNetwork -Name '; 50 | ScriptBlock = $ScriptBlock; 51 | }; 52 | ) 53 | 54 | foreach ($ArgumentCompleter in $ArgumentCompleterList) { 55 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; 56 | } -------------------------------------------------------------------------------- /Completers/Microsoft.Azure.CloudService.ServiceName.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ArgumentCompleter = @{ 2 | CommandName = @('Add-AzureCertificate', 3 | 'Add-AzureDns', 4 | 'Add-AzureInternalLoadBalancer', 5 | 'Export-AzureVM', 6 | 'Get-AzureCertificate', 7 | 'Get-AzureDeployment', 8 | 'Get-AzureDeploymentEvent', 9 | 'Get-AzureInternalLoadBalancer', 10 | 'Get-AzureRemoteDesktopFile', 11 | 'Get-AzureRole', 12 | 'Get-AzureService', 13 | 'Get-AzureServiceADDomainExtension', 14 | 'Get-AzureServiceAntimalwareConfig', 'Get-AzureServiceDiagnosticsExtension', 'Get-AzureServiceExtension', 'Get-AzureServiceRemoteDesktopExtension', 'Get-AzureVM', 'Get-AzureWinRMUri', 'Move-AzureDeployment', 'New-AzureDeployment', 'New-AzureQuickVM', 'New-AzureService', 'New-AzureServiceProject', 'New-AzureVM', 'Publish-AzureServiceProject', 'Remove-AzureCertificate', 'Remove-AzureDeployment', 'Remove-AzureDns', 'Remove-AzureInternalLoadBalancer', 'Remove-AzureService', 'Remove-AzureServiceADDomainExtension', 'Remove-AzureServiceAntimalwareExtension', 'Remove-AzureServiceDiagnosticsExtension', 'Remove-AzureServiceExtension', 'Remove-AzureServiceRemoteDesktopExtension', 'Remove-AzureVM', 'Reset-AzureRoleInstance', 'Restart-AzureVM', 'Save-AzureVMImage', 'Set-AzureDeployment', 'Set-AzureDns', 'Set-AzureInternalLoadBalancer', 'Set-AzureLoadBalancedEndpoint', 'Set-AzureRole', 'Set-AzureService', 'Set-AzureServiceADDomainExtension', 'Set-AzureServiceAntimalwareExtension', 'Set-AzureServiceDiagnosticsExtension', 'Set-AzureServiceExtension', 'Set-AzureServiceRemoteDesktopExtension', 'Set-AzureWalkUpgradeDomain', 'Start-AzureService', 'Start-AzureVM', 'Stop-AzureService', 'Stop-AzureVM', 'Update-AzureVM'); 15 | ParameterName = 'ServiceName'; 16 | #Description = 'Complete the -ServiceName parameter value for Azure cmdlets: Get-AzureService -ServiceName '; 17 | ScriptBlock = { 18 | <# 19 | .SYNOPSIS 20 | Auto-complete the -ServiceName parameter value for Azure PowerShell cmdlets. 21 | 22 | .NOTES 23 | Created by Trevor Sullivan 24 | http://trevorsullivan.net 25 | #> 26 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 27 | 28 | $ItemList = Get-AzureService | Where-Object { $PSItem.ServiceName -match $wordToComplete } | ForEach-Object { 29 | $CompletionText = $PSItem.ServiceName 30 | $ToolTip = 'Cloud Service in "{0}" region.' -f $PSItem.ExtendedProperties.ResourceLocation 31 | $ListItemText = '{0} ({1})' -f $PSItem.ServiceName, $PSItem.ExtendedProperties.ResourceLocation 32 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue 33 | 34 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 35 | } 36 | 37 | return $ItemList 38 | } 39 | } 40 | 41 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; -------------------------------------------------------------------------------- /Completers/Microsoft.Azure.Storage.BlobName.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ScriptBlock = { 2 | <# 3 | .SYNOPSIS 4 | Auto-complete the -Name parameter value for Azure PowerShell storage container cmdlets. 5 | 6 | .NOTES 7 | Created by Trevor Sullivan 8 | http://trevorsullivan.net 9 | #> 10 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 11 | 12 | $StorageContext = $fakeBoundParameter['Context']; 13 | $ContainerList = Get-AzureStorageContainer -Context $StorageContext; 14 | $BlobList = @(); 15 | foreach ($Container in $ContainerList) { 16 | foreach ($Blob in (Get-AzureStorageBlob -Context $StorageContext -Container $Container.Name)) { 17 | $BlobList += $Blob | Add-Member -MemberType NoteProperty -Name ContainerName -Value $Container.Name -PassThru; 18 | } 19 | } 20 | 21 | $BlobList = $BlobList | Where-Object -FilterScript { $PSItem.Name -match ${wordToComplete} } | ForEach-Object { 22 | $CompletionText = '{0} -ContainerName {1}' -f $PSItem.Name, $PSItem.ContainerName; 23 | $ToolTip = 'Blob named "{0}" in "{1}" container.' -f $PSItem.Name, $PSItem.ContainerName; 24 | $ListItemText = '{0} ({1})' -f $PSItem.Name, $PSItem.ContainerName; 25 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 26 | 27 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 28 | } 29 | 30 | return $BlobList; 31 | } 32 | 33 | $ArgumentCompleter = @{ 34 | ### (Get-Command -Module Azure.Storage -ParameterName Container).ForEach({ "'{0}'," -f $PSItem.Name; }) | Set-Clipboard; 35 | CommandName = @( 36 | 'Stop-CopyAzureStorageBlob', 37 | 'Get-AzureStorageBlob', 38 | 'Get-AzureStorageBlobContent', 39 | 'Get-AzureStorageBlobCopyState', 40 | 'New-AzureStorageBlobSASToken', 41 | 'Remove-AzureStorageBlob', 42 | 'Set-AzureStorageBlobContent', 43 | 'Stop-AzureStorageBlobCopy' 44 | ); 45 | ParameterName = 'Blob'; 46 | ScriptBlock = $ScriptBlock; 47 | } 48 | 49 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; 50 | -------------------------------------------------------------------------------- /Completers/Microsoft.Azure.Storage.StorageAccountName.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ArgumentCompleter = @{ 2 | CommandName = @('Enable-WAPackWebsiteApplicationDiagnositc', 3 | 'Add-AzureHDInsightStorage', 4 | 'Enable-AzureWebsiteApplicationDiagnostic', 5 | 'Get-AzureStorageAccount', 6 | 'Get-AzureStorageKey', 7 | 'New-AzureMediaServicesAccount', 8 | 'New-AzureStorageAccount', 9 | 'New-AzureStorageContext', 10 | 'New-AzureStorageKey', 11 | 'Publish-AzureServiceProject', 12 | 'Remove-AzureStorageAccount', 13 | 'Set-AzureHDInsightDefaultStorage', 14 | 'Set-AzureStorageAccount', 15 | 'Set-AzureVMCustomScriptExtension' ); 16 | ParameterName = 'StorageAccountName'; 17 | #Description = 'Complete the -StorageAccountName parameter value for Azure cmdlets: Get-AzureStorageAccount -StorageAccountName '; 18 | ScriptBlock = { 19 | <# 20 | .SYNOPSIS 21 | Auto-complete the -StorageAccountName parameter value for Azure PowerShell cmdlets. 22 | 23 | .NOTES 24 | 25 | Created by Trevor Sullivan 26 | http://trevorsullivan.net 27 | #> 28 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 29 | 30 | #Write-Verbose -Message ('Called Azure StorageAccountName completer at {0}' -f (Get-Date)) 31 | 32 | $StorageAccountList = Get-AzureStorageAccount -WarningAction SilentlyContinue | Where-Object {$PSItem.StorageAccountName -match ${wordToComplete} } | ForEach-Object { 33 | $CompletionText = $PSItem.StorageAccountName 34 | $ToolTip = 'Storage Account "{0}" in "{1}" region.' -f $PSItem.StorageAccountName, $PSItem.Location 35 | $ListItemText = '{0} ({1})' -f $PSItem.StorageAccountName, $PSItem.Location 36 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue 37 | 38 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 39 | } 40 | 41 | return $StorageAccountList 42 | } 43 | } 44 | 45 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; -------------------------------------------------------------------------------- /Completers/Microsoft.Azure.Storage.StorageContainerName.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ScriptBlock = { 2 | <# 3 | .SYNOPSIS 4 | Auto-complete the -Name parameter value for Azure PowerShell storage container cmdlets. 5 | 6 | .NOTES 7 | Created by Trevor Sullivan 8 | http://trevorsullivan.net 9 | #> 10 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 11 | 12 | $ContainerList = Get-AzureStorageContainer -Context $fakeBoundParameter['Context'] | Where-Object -FilterScript { $PSItem.Name -match ${wordToComplete} } | ForEach-Object { 13 | $CompletionText = $PSItem.Name; 14 | $ToolTip = 'Storage Container "{0}" in "{1}" Storage Account.' -f $PSItem.Name, $fakeBoundParameter['Context'].StorageAccountName; 15 | $ListItemText = '{0} ({1})' -f $PSItem.Name, $fakeBoundParameter['Context'].StorageAccountName; 16 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue; 17 | 18 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 19 | } 20 | 21 | return $ContainerList; 22 | } 23 | 24 | $ArgumentCompleter = @{ 25 | CommandName = @( 26 | 'Get-AzureStorageContainerAcl', 27 | 'Get-AzureSiteRecoveryProtectionContainer', 28 | 'Get-AzureStorageContainer', 29 | 'New-AzureStorageContainer', 30 | 'New-AzureStorageContainerSASToken', 31 | 'Remove-AzureStorageContainer', 32 | 'Set-AzureStorageContainerAcl' 33 | ); 34 | ParameterName = 'Name'; 35 | ScriptBlock = $ScriptBlock; 36 | } 37 | 38 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; 39 | 40 | $ArgumentCompleter = @{ 41 | ### (Get-Command -Module Azure.Storage -ParameterName Container).ForEach({ "'{0}'," -f $PSItem.Name; }) | Set-Clipboard; 42 | CommandName = @( 43 | 'Get-AzureStorageContainerAcl', 44 | 'Stop-CopyAzureStorageBlob', 45 | 'Get-AzureStorageBlob', 46 | 'Get-AzureStorageBlobContent', 47 | 'Get-AzureStorageBlobCopyState', 48 | 'Get-AzureStorageContainer', 49 | 'Get-AzureStorageContainerStoredAccessPolicy', 50 | 'New-AzureStorageBlobSASToken', 51 | 'New-AzureStorageContainer', 52 | 'New-AzureStorageContainerSASToken', 53 | 'New-AzureStorageContainerStoredAccessPolicy', 54 | 'Remove-AzureStorageBlob', 55 | 'Remove-AzureStorageContainer', 56 | 'Remove-AzureStorageContainerStoredAccessPolicy', 57 | 'Set-AzureStorageBlobContent', 58 | 'Set-AzureStorageContainerAcl', 59 | 'Set-AzureStorageContainerStoredAccessPolicy', 60 | 'Stop-AzureStorageBlobCopy' 61 | ); 62 | ParameterName = 'Name'; 63 | ScriptBlock = $ScriptBlock; 64 | } 65 | 66 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; -------------------------------------------------------------------------------- /Completers/Microsoft.Azure.Subscription.SubscriptionName.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ArgumentCompleter = @{ 2 | CommandName = @( 3 | 'Get-WAPackSubscription', 4 | 'Remove-WAPackSubscription', 5 | 'Select-WAPackSubscription', 6 | 'Set-WAPackSubscription', 7 | 'Get-AzureSubscription', 8 | 'New-AzureSqlDatabaseServerContext', 9 | 'Remove-AzureSubscription', 10 | 'Select-AzureSubscription', 11 | 'Set-AzureSubscription' 12 | ); 13 | ParameterName = 'SubscriptionName'; 14 | #Description = 'Complete the -SubscriptionName parameter value for Azure cmdlets: Select-AzureSubscription -SubscriptionName '; 15 | ScriptBlock = { 16 | <# 17 | .SYNOPSIS 18 | Auto-complete the -SubscriptionName parameter value for Azure PowerShell cmdlets. 19 | 20 | .NOTES 21 | Created by Trevor Sullivan 22 | http://trevorsullivan.net 23 | #> 24 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 25 | 26 | #Write-Verbose -Message ('Called Azure SubscriptionName completer at {0}' -f (Get-Date)) 27 | 28 | ### Create fresh completion results for Azure subscriptions 29 | $ItemList = Get-AzureSubscription | Where-Object { $PSItem.SubscriptionName -match ${wordToComplete} } | ForEach-Object { 30 | $CompletionText = $PSItem.SubscriptionName 31 | $ToolTip = 'Azure subscription "{0}" with ID {1}.' -f $PSItem.SubscriptionName, $PSItem.SubscriptionId 32 | $ListItemText = '{0} ({1})' -f $PSItem.SubscriptionName, $PSItem.SubscriptionId 33 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue 34 | 35 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 36 | } 37 | 38 | ### Return the fresh completion results 39 | return $ItemList 40 | } 41 | } 42 | 43 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; 44 | -------------------------------------------------------------------------------- /Completers/Microsoft.Azure.VirtualMachine.Name.ArgumentCompleters.ps1: -------------------------------------------------------------------------------- 1 | $ArgumentCompleter = @{ 2 | CommandName = @('Export-AzureVM', 3 | 'Get-AzureVM', 4 | 'Remove-AzureVM', 5 | 'Restart-AzureVM', 6 | 'Start-AzureVM', 7 | 'Stop-AzureVM', 8 | 'Update-AzureVM', 9 | 'Get-AzureRemoteDesktopFile'); 10 | ParameterName = 'Name'; 11 | #Description = 'Complete the -Name parameter value for Azure virtual machine cmdlets: Stop-AzureVM -Name '; 12 | ScriptBlock = { 13 | <# 14 | .SYNOPSIS 15 | Auto-complete the -Name parameter value for Azure PowerShell virtual machine cmdlets. 16 | 17 | .NOTES 18 | Created by Trevor Sullivan 19 | http://trevorsullivan.net 20 | http://twitter.com/pcgeek86 21 | #> 22 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) 23 | 24 | #Write-Verbose -Message ('Called Azure Virtual Machine Name completer at {0}' -f (Get-Date)) 25 | 26 | ### Create fresh completion results for Azure virtual machines 27 | $ItemList = Get-AzureVM | Where-Object { $PSItem.Name -match $wordToComplete } | ForEach-Object { 28 | $CompletionText = '{0} -ServiceName {1}' -f $PSItem.Name, $PSItem.ServiceName 29 | $ToolTip = 'Azure VM {0}/{1} in state {2}.' -f $PSItem.ServiceName, $PSItem.Name, $PSItem.Status 30 | $ListItemText = '{0}/{1}' -f $PSItem.ServiceName, $PSItem.Name 31 | $CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue 32 | 33 | New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList @($CompletionText, $ListItemText, $CompletionResultType, $ToolTip); 34 | } 35 | 36 | ### Return the fresh completion results 37 | return $ItemList 38 | } 39 | } 40 | 41 | Microsoft.PowerShell.Core\Register-ArgumentCompleter @ArgumentCompleter; -------------------------------------------------------------------------------- /Completers/README.MD: -------------------------------------------------------------------------------- 1 | This folder contains "argument completer" functions. 2 | These argument completer functions perform auto-completion for PowerShell Intellisense, when it is invoked by a user, typically using the {CTRL} + {SPACE} keyboard shortcut, or by putting a space after a parameter name. 3 | 4 | **NOTE**: Each individual script file contained in this folder is responsible for defining *and* registering a single, custom argument completer. 5 | 6 | For Azure Service Management (ASM) argument completers, the file name should match the following format: 7 | 8 | ``` 9 | Microsoft.Azure...ArgumentCompleters.ps1 10 | ``` 11 | 12 | For Azure Resource Manager (ARM) argument completers, the file name should match the following format: 13 | 14 | ``` 15 | Microsoft.AzureRm...ArgumentCompleters.ps1 16 | ``` 17 | 18 | When the AzureExt module is imported, the module file scans for **all** files in the `Completers` folder, that have a `.ps1` file extension, and calls them. 19 | 20 | -------------------------------------------------------------------------------- /Format Types/Azure.PublicIP.format.ps1xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AzurePublicIP 6 | 7 | Microsoft.Azure.Commands.Network.Models.PSPublicIpAddress 8 | 9 | 10 | 11 | 12 | 30 13 | 14 | 15 | 14 16 | 17 | 18 | 12 19 | 20 | 21 | 20 22 | 23 | 24 | 12 25 | 26 | 27 | 28 | 29 | 30 | 31 | ResourceGroupName 32 | 33 | 34 | Location 35 | 36 | 37 | Name 38 | 39 | 40 | IpAddress 41 | 42 | 43 | PublicIpAllocationMethod 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /Format Types/Azure.ResourceGroup.format.ps1xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AzureResourceGroup 6 | 7 | Microsoft.Azure.Commands.Resources.Models.PSResourceGroup 8 | Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.PSResourceGroup 9 | 10 | 11 | 12 | 13 | 30 14 | 15 | 16 | 14 17 | 18 | 19 | 12 20 | 21 | 22 | 23 | 50 24 | 25 | 26 | 27 | 28 | 29 | 30 | ResourceGroupName 31 | 32 | 33 | Location 34 | 35 | 36 | ProvisioningState 37 | 38 | 39 | $PSItem.Tags | ForEach-Object -Begin { $TagList = '' } -Process { if ($PSItem) { $TagList += '{0}={1};' -f $PSItem.Name, $PSItem.Value; } } -End { $TagList } 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Format Types/Azure.StorageAccount.format.ps1xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AzurePublicIP 6 | 7 | Microsoft.Azure.Commands.Management.Storage.Models.PSStorageAccount 8 | 9 | 10 | 11 | 12 | 30 13 | 14 | 15 | 14 16 | 17 | 18 | 12 19 | 20 | 21 | 22 | 20 23 | 24 | 25 | 12 26 | 27 | 28 | 12 29 | 30 | 31 | 32 | 33 | 34 | 35 | ResourceGroupName 36 | 37 | 38 | StorageAccountName 39 | 40 | 41 | Location 42 | 43 | 44 | $PSItem.CustomDomain.Name 45 | 46 | 47 | Encryption 48 | 49 | 50 | AccessTier 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /Format Types/Azure.VirtualMachine.format.ps1xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AzureVirtualMachine 6 | 7 | Microsoft.Azure.Commands.Compute.Models.PSVirtualMachine 8 | 9 | 10 | 11 | 12 | 30 13 | 14 | 15 | 15 16 | 17 | 18 | 12 19 | 20 | 21 | 12 22 | 23 | 24 | 25 | 12 26 | 27 | 28 | 29 | 30 | 31 | 32 | ResourceGroupName 33 | 34 | 35 | Name 36 | 37 | 38 | Location 39 | 40 | 41 | ProvisioningState 42 | 43 | 44 | $PSItem.HardwareProfile.VmSize 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Functions/Private/Get-AllAzureLocations.ps1: -------------------------------------------------------------------------------- 1 | # 2 | # Get_AllAzureLocations.ps1 3 | # 4 | 5 | function Get-AllAzureLocations { 6 | <# 7 | .Synopsis 8 | Retrieves a list of Azure locations, using the AzureResourceManager PowerShell module. 9 | 10 | .Description 11 | 12 | This function may be deprecated, or require modification, if the Get-AzureLocation command is changed 13 | from returning Azure platform features, to returning Azure locations. As of this implementation, the 14 | ARM Get-AzureLocation command returns a list of Azure Resource Providers as the top-level object. 15 | #> 16 | [CmdletBinding()] 17 | param () 18 | 19 | $LocationList = (AzureResourceManager\Get-AzureLocation).Locations | Select-Object -Unique | Sort-Object; 20 | Write-Output -InputObject $LocationList; 21 | } -------------------------------------------------------------------------------- /Functions/Public/Invoke-AzureRemoteDesktop.ps1: -------------------------------------------------------------------------------- 1 | function Invoke-AzureRemoteDesktop { 2 | <# 3 | .Author 4 | Trevor Sullivan 5 | 6 | .Description 7 | Invoke a RDP session to an Azure Virtual Machine, without having to type the 8 | Cloud Service name or Virtual Machine name. Instead, simply select it from the 9 | WPF window that pops open. This command is intended to work with the Azure 10 | Service Management (ASM) PowerShell module, not Azure Resource Manager (ARM). 11 | 12 | .Outputs 13 | None 14 | 15 | .Links 16 | http://trevorsullivan.net 17 | http://twitter.com/pcgeek86 18 | #> 19 | [CmdletBinding()] 20 | param ( 21 | [Parameter(Mandatory = $false, ParameterSetName = 'SpecifiedName')] 22 | [switch] $PromptSubscription 23 | , [Parameter(Position = 0, Mandatory = $false, ParameterSetName = 'SpecifiedName')] 24 | [Alias('svc')] 25 | [string] $ServiceName 26 | , [Parameter(Position = 1, Mandatory = $false, ParameterSetName = 'SpecifiedName')] 27 | [string] $Name 28 | , [Parameter(Position = 2, Mandatory = $false, ParameterSetName = 'SpecifiedName')] 29 | [Alias('sn')] 30 | [string] $SubscriptionName 31 | ) 32 | 33 | function Wait-AzureVM { 34 | param ( 35 | [Parameter(Mandatory = $true)] 36 | [string] $ServiceName 37 | , [Parameter(Mandatory = $true)] 38 | [string] $Name 39 | , [int] $WaitInSeconds = 10 40 | , [string] $State = 'ReadyRole' 41 | ) 42 | 43 | while (($VM = Get-AzureVM -ServiceName $ServiceName -Name $Name).Status -ne $State) { 44 | Start-Sleep -Seconds $WaitInSeconds; 45 | Write-Verbose -Message ('Virtual machine state {0}/{1} is {2}' -f $ServiceName, $Name, $VM.Status); 46 | $UserResult = $null; 47 | $UserResult = @('Yes', 'No') | Out-GridView -Title ('Keep waiting for {0} seconds?' -f $WaitInSeconds) -OutputMode Single; 48 | if (!$UserResult -or $UserResult -eq 'No') { 49 | throw 'User canceled waiting for VM to start up.'; 50 | return $false; 51 | } 52 | } 53 | Write-Verbose -Message ('Virtual machine {0}/{1} is up and running' -f $ServiceName, $Name); 54 | return $true; 55 | } 56 | 57 | function PromptSubscription { 58 | Write-Verbose -Message 'Prompting for Azure subscription.'; 59 | $SubscriptionList = Get-AzureSubscription; 60 | if (!$SubscriptionList) { 61 | & $AzureReauthenticate; 62 | } 63 | 64 | $Subscription = $SubscriptionList | Select-Object -Property SubscriptionName,SubscriptionId | Out-GridView -PassThru -Title 'Select your Azure Subscription'; 65 | if (!$Subscription) { 66 | Write-Warning -Message 'No Azure subscription was selected.'; 67 | return; 68 | } 69 | Select-AzureSubscription -SubscriptionName $Subscription.SubscriptionName; 70 | } 71 | 72 | $AzureReauthenticate = { 73 | $AuthResult = Add-AzureAccount 3>&1; 74 | 75 | if ($AuthResult -match 'User canceled authentication') { 76 | Write-Error -Message 'User canceled authentication, exiting function.'; 77 | return; 78 | } 79 | 80 | # Re-invoke the azrdp function using the same arguments that the user passed in originally 81 | $Parameters = (Get-PSCallStack)[1].InvocationInfo.BoundParameters; 82 | & $PSCmdlet.MyInvocation.MyCommand.Name @Parameters; 83 | } 84 | 85 | try { 86 | if ($PromptSubscription) { 87 | PromptSubscription; 88 | } 89 | 90 | $VM = Get-AzureVM -ErrorAction Stop | Out-GridView -PassThru -Title 'Select your Azure Virtual Machine'; 91 | 92 | if (!$VM) { 93 | Write-Warning -Message 'No virtual machines exist in this subscription, or no virtual machine was selected. Please create a virtual machine or select a different Azure subscription'; 94 | return; 95 | } 96 | if ($VM.Status -ne 'ReadyRole') { 97 | Write-Warning -Message 'The selected Azure virtual machine is not in the ReadyRole state.'; 98 | $OperationList = @( 99 | [PSCustomObject]@{ Name = 'Start'; Description = 'Start the Microsoft Azure Virtual Machine'; }; 100 | [PSCustomObject]@{ Name = 'Select New'; Description = 'Select a new Microsoft Azure Virtual Machine'; }; 101 | [PSCustomObject]@{ Name = 'Exit'; Description = 'Quit / exit this function'; }; 102 | ); 103 | $Operation = $OperationList | Out-GridView -OutputMode Single; 104 | if ($Operation.Name -eq 'Start') { 105 | ### Start the VM using Azure Resource Manager (ARM) instead of Service Management, 106 | ### if the VM is an IaaSv2 VM. 107 | if ($VM.ResourceGroupName -and $VM.Name) { 108 | Start-AzureVM -ResourceGroupName $VM.ResourceGroupName -Name $VM.Name; } 109 | elseif ($VM.ServiceName -and $VM.Name) { 110 | Start-AzureVM -ServiceName $VM.ServiceName -Name $VM.Name; } 111 | 112 | 113 | if (Wait-AzureVM -ServiceName $VM.ServiceName -Name $VM.Name) { 114 | Get-AzureRemoteDesktopFile -ServiceName $VM.ServiceName -Name $VM.Name -Launch; 115 | } 116 | return; 117 | } 118 | elseif ($Operation.Name -eq 'Exit') { 119 | Write-Warning -Message 'User elected to quit the function.'; 120 | return; 121 | } 122 | elseif ($Operation.Name -eq 'Select New') { 123 | & $PSCmdlet.MyInvocation.MyCommand.Name @PSBoundParameters; 124 | return; 125 | } 126 | } 127 | 128 | Write-Verbose -Message ('Invoking Remote Desktop session to {0}\{1}' -f $VM.ServiceName, $VM.Name); 129 | Get-AzureRemoteDesktopFile -ServiceName $VM.ServiceName -Name $VM.Name -Launch; 130 | } 131 | catch [System.ArgumentException] { 132 | if ($PSItem.Exception.Message -match 'Add-AzureAccount') { 133 | & $AzureReauthenticate; 134 | } 135 | } 136 | catch [System.ApplicationException] { 137 | if ($PSItem.Exception.Message -match 'No default subscription') { 138 | & $AzureReauthenticate; 139 | } 140 | } 141 | } -------------------------------------------------------------------------------- /Functions/Public/Invoke-AzureRmRemoteDesktop.ps1: -------------------------------------------------------------------------------- 1 | function Invoke-AzureRmRemoteDesktop { 2 | <# 3 | .Author 4 | Trevor Sullivan 5 | 6 | .Description 7 | Invoke a RDP session to an Azure Virtual Machine, without having to type the 8 | Resource Group name or Virtual Machine name. Instead, simply select it from the 9 | WPF window that pops open. This command is intended to work with the Azure 10 | Resource Manager (ARM) PowerShell module, not Azure Service Management (ASM). 11 | 12 | .Outputs 13 | None 14 | 15 | .Links 16 | http://trevorsullivan.net 17 | http://twitter.com/pcgeek86 18 | #> 19 | [CmdletBinding()] 20 | param ( 21 | [Parameter(Position = 0, Mandatory = $false, ParameterSetName = 'SpecifiedName')] 22 | [Alias('rgname')] 23 | [string] $ResourceGroupName 24 | , [Parameter(Position = 1, Mandatory = $false, ParameterSetName = 'SpecifiedName')] 25 | [string] $Name 26 | ) 27 | 28 | $VM = Get-AzureRmVM -ErrorAction Stop | Out-GridView -PassThru -Title 'Select your Azure Virtual Machine'; 29 | 30 | if (!$VM) { 31 | Write-Warning -Message 'No virtual machines exist in this subscription, or no virtual machine was selected. Please create a virtual machine or select a different Azure subscription'; 32 | return; 33 | } 34 | 35 | Write-Verbose -Message ('Invoking Remote Desktop session to {0}\{1}' -f $VM.ResourceGroupName, $VM.Name); 36 | Get-AzureRmRemoteDesktopFile -ResourceGroupName $VM.ResourceGroupName -Name $VM.Name -Launch; 37 | } -------------------------------------------------------------------------------- /Functions/Public/Publish-AzureStorageBlob.ps1: -------------------------------------------------------------------------------- 1 | function Publish-AzureStorageBlob { 2 | [CmdletBinding(SupportsShouldProcess = $true)] 3 | param ( 4 | ) 5 | 6 | ### Load the Windows Forms .NET Assembly 7 | Add-Type -AssemblyName System.Windows.Forms; 8 | $OpenFileDialog = New-Object -TypeName System.Windows.Forms.OpenFileDialog; 9 | $OpenFileDialog.Multiselect = $true; 10 | $DialogResult = $OpenFileDialog.ShowDialog(); 11 | if ($DialogResult -ne [System.Windows.Forms.DialogResult]::OK) { 12 | throw 'Please select one or more files to upload to the Microsoft Azure blob storage container.'; 13 | } 14 | 15 | ### Prompt user to select a Microsoft Azure Storage Account to upload the file(s) to 16 | $StorageAccount = Get-AzureRmStorageAccount | Select-Object -Property StorageAccountName, Location, AffinityGroup | Out-GridView -OutputMode Single; 17 | if (!$StorageAccount) { 18 | throw 'No Azure Storage Account was selected. Please re-run the command and select a Microsoft Azure Storage Account.'; 19 | } 20 | $StorageKey = Get-AzureRmStorageAccountKey -StorageAccountName $StorageAccount.StorageAccountName; 21 | $StorageContext = New-AzureStorageContext -StorageAccountName $StorageAccount.StorageAccountName -StorageAccountKey $StorageKey.Primary; 22 | 23 | ### Prompt user to select a Microsoft Azure Blob Container (inside the Storage Account) to upload the file(s) to 24 | $ContainerList = Get-AzureStorageContainer -Context $StorageContext; 25 | $Container = $ContainerList | Out-GridView -Title 'Please select a target Microsoft Azure blob storage container.' -OutputMode Single; 26 | 27 | ### If the user does not select a container, then prompt the user to create a new one. 28 | if (!$Container) { 29 | $ContainerName = Read-Host -Prompt 'Please enter a container name'; 30 | if ($ContainerList.Name -notcontains $ContainerName) { 31 | $Container = New-AzureStorageContainer -Context $StorageContext -Name $ContainerName; 32 | } 33 | else { 34 | throw 'Container named {0} already exists in Storage Account {1}. Please re-run the command and use a different container name.' -f $ContainerName, $StorageAccount.StorageAccountName; 35 | } 36 | } 37 | 38 | foreach ($File in $OpenFileDialog.FileNames) { 39 | Write-Verbose -Message ('Uploading file {0} to {1}/{2}' -f $File, $StorageAccount.StorageAccountName, $Container.Name); 40 | if ($PSCmdlet.ShouldProcess($File, 'Upload to Azure blob storage')) { 41 | try { 42 | Set-AzureStorageBlobContent -Context $StorageContext -Container $Container.Name -File $File -ErrorAction Stop; 43 | } 44 | catch { 45 | Write-Warning -Message ('Failed to copy {0} to Azure blob container' -f $File); 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Functions/Public/Remove-AzureRmResourceGroupGui.ps1: -------------------------------------------------------------------------------- 1 | function Remove-AzureRmResourceGroupGui { 2 | <# 3 | .Synopsis 4 | Removes Azure Resource Manager (ARM) Resource Groups, using a simple GUI. 5 | 6 | .Description 7 | 8 | 9 | .Example 10 | Remove-AzureRmResourceGroupGui 11 | #> 12 | [CmdletBinding(SupportsShouldProcess = $true)] 13 | param ( 14 | ) 15 | 16 | ### Prompt user to select a Microsoft Azure Storage Account to upload the file(s) to 17 | $ResourceGroupList = Get-AzureRmResourceGroup | Out-GridView -OutputMode Multiple -Title 'Please select one or more Resource Groups to delete'; 18 | if (!$ResourceGroupList) { 19 | throw 'No Azure Resource Groups were selected. Please re-run the command and select one or more Microsoft Azure Resource Groups.'; 20 | } 21 | 22 | $ResourceGroupList | Remove-AzureRmResourceGroup -Force; 23 | } -------------------------------------------------------------------------------- /Functions/Public/Remove-AzureRmResourceGui.ps1: -------------------------------------------------------------------------------- 1 | function Remove-AzureRmResourceGui { 2 | <# 3 | .Synopsis 4 | Removes Azure Resource Manager (ARM) Resources, using a simple GUI. 5 | 6 | .Description 7 | Removes Azure Resource Manager (ARM) Resources, using a simple GUI. 8 | 9 | .Example 10 | Remove-AzureRmResourceGui 11 | #> 12 | [CmdletBinding(SupportsShouldProcess = $true)] 13 | param ( 14 | ) 15 | 16 | ### Prompt user to select a Microsoft Azure Storage Account to upload the file(s) to 17 | $ResourceList = Get-AzureRmResource | Out-GridView -OutputMode Multiple -Title 'Please select one or more Resources to delete'; 18 | if (!$ResourceList) { 19 | throw 'No Azure Resources were selected. Please re-run the command and select one or more Microsoft Azure Resources.'; 20 | return; 21 | } 22 | 23 | $ResourceList | Remove-AzureRmResource -Force; 24 | } -------------------------------------------------------------------------------- /Functions/Public/Resize-AzureRmVm.ps1: -------------------------------------------------------------------------------- 1 | function Resize-AzureRmVM { 2 | <# 3 | .Synopsis 4 | Resizes Microsoft Azure Virtual Machines to a new size. 5 | 6 | .Description 7 | This command resizes Microsoft Azure Virtual Machines. Use the Get-AzureRmVmSize command to determine an authoritative list of supported Azure Virtual Machine sizes. 8 | 9 | .Example 10 | 11 | ### Resize multiple Azure Virtual Machines at once 12 | Resize-AzureRmVm -Gui; 13 | 14 | .Example 15 | 16 | ### Resize a single Azure Virtual Machine 17 | Resize-AzureRmVm -ResourceGroupName MyCoolResourceGroup -Name UbuntuVM -Size Standard_A4; 18 | 19 | .Example 20 | 21 | ### Resize an Azure Virtual Machine using pipelining 22 | Get-AzureRmVm -ResourceGroupName LinuxStuff -Name Ubuntu | Resize-AzureRmVm -Size Standard_A2; 23 | 24 | .Link 25 | https://trevorsullivan.net 26 | https://artofshell.com 27 | #> 28 | [CmdletBinding()] 29 | param ( 30 | [Parameter(ValueFromPipelineByPropertyName = $true, Mandatory = $true, ParameterSetName = 'VM', HelpMessage = 'Please enter the name of the Azure Resource Group where the Virtual Machine lives')] 31 | [string] $ResourceGroupName 32 | , [Parameter(ValueFromPipelineByPropertyName = $true, Mandatory = $true, ParameterSetName = 'VM', HelpMessage = 'Please enter the name of the Azure VM in the Resource Group')] 33 | [string] $Name 34 | , [Parameter(Mandatory = $true, ParameterSetName = 'VM', HelpMessage = 'Please specify the Azure VM size you want to configure this VM with')] 35 | [ValidateScript({ 36 | $VMSizeList = (Get-AzureRmVmSize -Location westus).Name; 37 | if ($VMSizeList -contains $_) { return true; } 38 | else { throw 'Please select one of the following VM sizes: {0}' -f ($VMSizeList -join ', '); return false; } 39 | })] 40 | [string] $Size 41 | , [Parameter(ParameterSetName = 'Gui', Mandatory = $true)] 42 | [switch] $Gui 43 | ) 44 | 45 | process { 46 | try { 47 | if ($PSCmdlet.ParameterSetName -eq 'Gui') { 48 | $VMList = Get-AzureRmVm | Out-GridView -OutputMode Multiple -Title 'Please select an Azure Virtual Machine to resize.'; 49 | $TargetSize = Get-AzureRmVmSize -Location westus | Out-GridView -OutputMode Single -Title 'Please select a target Azure Virtual Machine size.'; 50 | foreach ($VM in $VMList) { 51 | Write-Verbose -Message ('Resizing Microsoft Azure Virtual Machine {0} in Resource Group {1} to size {2}' -f $VM.Name, $VM.ResourceGroupName, $TargetSize); 52 | $VM.HardwareProfile.VmSize = $TargetSize.Name; 53 | Update-AzureRmVm -VM $VM -ResourceGroupName $VM.ResourceGroupName 54 | } 55 | } 56 | else { 57 | Write-Verbose -Message ('Resizing Microsoft Azure Virtual Machine {0} in Resource Group {1} to size {2}' -f $Name, $ResourceGroupName, $Size); 58 | $VM = Get-AzureRmVm -ResourceGroupName $ResourceGroupName -Name $Name; 59 | $VM.HardwareProfile.VmSize = $Size; 60 | Update-AzureRmVm -ResourceGroupName $VM.ResourceGroupName -VM $VM; 61 | } 62 | } 63 | catch { 64 | throw 'An error occurred while trying to resize the VM {0}\{1}: {2}' -f $ResourceGroupName, $Name, $PSItem.Exception.Message 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /Functions/Public/Start-AzureRm.ps1: -------------------------------------------------------------------------------- 1 | function Start-AzureRm { 2 | <# 3 | .Synopsis 4 | Loads or creates a cached Azure Profile. 5 | 6 | .Description 7 | Loads a cached Azure Profile from disk, if it exists, otherwise the user is prompted to create it. 8 | 9 | This command has no parameters. 10 | 11 | .Example 12 | Start-AzureRm; 13 | #> 14 | [CmdletBinding()] 15 | param () 16 | 17 | $script:AzureProfilePath = '{0}\AzureProfile.json' -f $env:USERPROFILE; 18 | try { 19 | ### Load the Azure Profile from the local disk 20 | $null = Select-AzureRmProfile -Path $script:AzureProfilePath; 21 | Find-AzureRmResourceGroup -Tag @{ Name = 'NonExistentTag'; } -WarningAction Ignore; 22 | } catch { 23 | $AzureProfile = Add-AzureRmAccount -Credential (Get-Credential); 24 | Save-AzureRmProfile -Path $script:AzureProfilePath -Profile $AzureProfile; 25 | } 26 | 27 | ### Import the PowerShell ISE Snippets, if we are running inside PowerShell ISE 28 | if ($Host.Name -match 'ISE') { 29 | Import-IseSnippet -Module AzureExt; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Functions/Public/Unpublish-AzureStorageBlob.ps1: -------------------------------------------------------------------------------- 1 | function Unpublish-AzureStorageBlob { 2 | <# 3 | .Synopsis 4 | Removes Azure blobs from a blob container in an Azure Storage Account using a simple, graphical interface. 5 | 6 | .Description 7 | This command uses the built-in PowerShell v3.0 (and later) Out-GridView command to prompt the user for an 8 | array of Azure Storage Blobs to remove from the Azure Blob Storage Container. 9 | 10 | .Example 11 | Unpublish-AzureStorageBlob; 12 | #> 13 | [CmdletBinding(SupportsShouldProcess = $true)] 14 | param ( 15 | ) 16 | 17 | ### Prompt user to select a Microsoft Azure Storage Account to upload the file(s) to 18 | $StorageAccount = Get-AzureStorageAccount | Select-Object -Property StorageAccountName, Location, AffinityGroup | Out-GridView -OutputMode Single; 19 | if (!$StorageAccount) { 20 | throw 'No Azure Storage Account was selected. Please re-run the command and select a Microsoft Azure Storage Account.'; 21 | } 22 | $StorageKey = Get-AzureStorageKey -StorageAccountName $StorageAccount.StorageAccountName; 23 | $StorageContext = New-AzureStorageContext -StorageAccountName $StorageKey.StorageAccountName -StorageAccountKey $StorageKey.Primary; 24 | 25 | ### Prompt user to select a Microsoft Azure Blob Container (inside the Storage Account) to upload the file(s) to 26 | $ContainerList = Get-AzureStorageContainer -Context $StorageContext; 27 | $Container = $ContainerList | Out-GridView -Title 'Please select a target Microsoft Azure blob storage container.' -OutputMode Single; 28 | 29 | ### Retrieve list of blobs inside blob container 30 | $BlobList = Get-AzureStorageBlob -Context $StorageContext -Container $Container.Name; 31 | 32 | ### If there are no blobs in the container, then throw an exception and exit function 33 | if (!$BlobList) { 34 | throw 'No blobs found in {0}/{1}' -f $StorageAccount.StorageAccountName, $Container.Name; 35 | return; 36 | } 37 | 38 | ### Prompt user to select Azure Storage Blobs to remove. 39 | $BlobList = $BlobList | Out-GridView -Title 'Please select the Azure Storage Blobs to remove.' -OutputMode Multiple; 40 | 41 | ### Remove each Azure blob that was selected by the user 42 | foreach ($Blob in $BlobList) { 43 | Write-Verbose -Message ('Removing blob {0} from {1}/{2}' -f $Blob.Name, $StorageAccount.StorageAccountName, $Container.Name); 44 | if ($PSCmdlet.ShouldProcess($Blob.Name, 'Remove Azure Storage blob')) { 45 | try { 46 | Remove-AzureStorageBlob -Context $StorageContext -Container $Container.Name -Blob $Blob.Name -Force; 47 | } 48 | catch { 49 | Write-Warning -Message ('Failed to remove Azure Storage blob' -f $Blob.Name); 50 | } 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /Images/README.md: -------------------------------------------------------------------------------- 1 | This folder contains images that pertain to the AzureExt project. These images may be accessed from other websites, the PowerShell Gallery, or used within documentation. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Trevor Sullivan 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /Patch-ModuleManifest.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Author 3 | Trevor Sullivan 4 | 5 | .Description 6 | Publishes the PowerShell module to the PowerShell Gallery. 7 | This PowerShell script is invoked by AppVeyor after the "Deploy" phase has completed successfully. 8 | 9 | .Parameter Path 10 | The path to the module manifest file. 11 | 12 | .Parameter BuildNumber 13 | The unique build number, typically passed in from a Continuous Integration (CI) service, such as AppVeyor. 14 | #> 15 | 16 | function Patch-ModuleManifest { 17 | [CmdletBinding()] 18 | param ( 19 | [Parameter(Mandatory = $false)] 20 | [string] $Path 21 | , [string] $BuildNumber 22 | ) 23 | 24 | if (!$Path) { 25 | $Path = Get-ChildItem -Path $env:APPVEYOR_BUILD_FOLDER\* -Include *.psd1; 26 | if (!$Path) { throw 'Could not find a module manifest file'; } 27 | } 28 | 29 | $ManifestContent = Get-Content -Path $Path -Raw; 30 | $ManifestContent = $ManifestContent -replace '(?<=ModuleVersion\s+=\s+'')(?.*)(?='')', ('${{ModuleVersion}}.{0}' -f $BuildNumber); 31 | Set-Content -Path $Path -Value $ManifestContent; 32 | 33 | $ManifestContent -match '(?<=ModuleVersion\s+=\s+'')(?.*)(?='')'; 34 | Get-Content -Path $Path; 35 | Write-Verbose -Message ('Module Version patched: ' + $Matches.ModuleVersion); 36 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Introduction 4 | 5 | This PowerShell script module project is intended to offer extensions to the Microsoft Azure PowerShell module, to simplify interactive use, and fill in functional & documentation gaps. 6 | The specific areas that it will help fill are: 7 | 8 | - PowerShell Proxy functions - Simplify cmdlet calls that are unnecessarily complicated by default. 9 | - PowerShell Aliases - Reduce the amount of typing necessary to run Azure PowerShell commands interactively. 10 | - PowerShell about_* Help - Provide built-in PowerShell help that users are accustomed to, instead of browsing the web. 11 | - Auto-completer Functions - Automatic tab-completion for parameter values, to reduce the need to memorize cloud resource names. 12 | 13 | # Installation 14 | 15 | **IMPORTANT**: The `AzureExt` module has a dependency on the `Register-ArgumentCompleter` command, which is available in PowerShell version 5.0. Please see the "Argument Completers" heading below for more information. 16 | 17 | The Azure PowerShell Extensions module is being developed and tested against PowerShell 5.0 on Windows 10 Enterprise RTM (Build 10240). 18 | PowerShell 5.0 introduces the centralized [PowerShell Gallery](http://powershellgallery.com), which is exposed via the built-in `PowerShellGet` module. 19 | PowerShell 5.0 can be installed on down-level operating systems, including Windows 7, Windows 8.1, Windows Server 2012 and 2012 R2, by way of the *"Windows Management Framework 5.0"* package. 20 | 21 | In PowerShell 5.0, using the `Find-Module` command, you can search for the latest version of the `AzureExt` module. 22 | 23 | ``` 24 | PS C:\Users\TrevorSullivan> Find-Module -Name AzureExt | Format-Table -AutoSize 25 | 26 | Version Name Repository Description 27 | ------- ---- ---------- ----------- 28 | 0.1.31 AzureExt PSGallery This PowerShell module provides extensions on top of the core Microsoft Azure Service Ma... 29 | ``` 30 | 31 | Using PowerShellGet's `Install-Module` command, you can easily install the `AzureExt` module. 32 | You can use the `-Scope` parameter to install the module for the currently logged-in user, or for all users of the system. 33 | To install a PowerShell module for all users, you must be running the PowerShell process as an Administrator of the system. 34 | 35 | ``` 36 | Install-Module -Name AzureExt -Scope CurrentUser; 37 | ``` 38 | 39 | When a new version of the module has been released, make sure to update it. 40 | 41 | ``` 42 | Update-Module -Name AzureExt; 43 | ``` 44 | 45 | For more information about `PowerShellGet` commands, use PowerShell's core `Get-Command` command: 46 | 47 | ``` 48 | PS C:\Users\TrevorSullivan> Get-Command -Module PowerShellGet | Format-Table -AutoSize; 49 | 50 | CommandType Name Version Source 51 | ----------- ---- ------- ------ 52 | Function Find-Module 1.0 PowerShellGet 53 | Function Get-InstalledModule 1.0 PowerShellGet 54 | Function Get-PSRepository 1.0 PowerShellGet 55 | Function Install-Module 1.0 PowerShellGet 56 | Function Publish-Module 1.0 PowerShellGet 57 | Function Register-PSRepository 1.0 PowerShellGet 58 | Function Save-Module 1.0 PowerShellGet 59 | Function Set-PSRepository 1.0 PowerShellGet 60 | Function Uninstall-Module 1.0 PowerShellGet 61 | Function Unregister-PSRepository 1.0 PowerShellGet 62 | Function Update-Module 1.0 PowerShellGet 63 | ``` 64 | 65 | # Usage 66 | 67 | Once the module has been installed, simply call `Import-Module -Name AzureExt;` in order to begin using its features. 68 | PowerShell 3.0 and later support a concept called "module auto-loading," which enables certain features (eg. explicitly exported aliases and functions) to be accessed without explicitly importing the module. 69 | However, we recommend importing the module, to ensure that all features (including auto-completers) are accessible. 70 | 71 | # Features 72 | 73 | ## Functions 74 | 75 | The `AzureExt` PowerShell module includes some useful functions that make it easier to work with the Azure PowerShell module. These are not intended to replace the Azure PowerShell module, but to provide a more user-friendly experience on top of it. 76 | 77 | - **Remove-AzuremRmResourceGroupGui** - This command enables you to delete multiple Microsoft Azure Resource Manager (ARM) Resource Groups at once, by CTRL + clicking them in the dialog that pops up 78 | - **Start-AzureRm** - The Microsoft Azure Resource Manager (ARM) PowerShell module removed the default behavior of caching your token. To simplify logging into Azure, each time you start a new PowerShell session, the `Start-AzureRm` command caches your token, and if it has expired, then it will prompt you to authenticate using the faster-loading `Get-Credential` command. 79 | 80 | ## Aliases 81 | 82 | The abbreviation "az" will generally be used to refer to "Azure" in PowerShell command aliases, to differentiate them from other aliases. 83 | 84 | The following aliases are supported by this module: 85 | 86 | ### Azure Profile 87 | 88 | The following PowerShell aliases apply to Azure authentication and subscription management. 89 | 90 | - **aazac** - Add-AzureAccount 91 | - **razac** - Remove-AzureAccount 92 | 93 | ### Virtual Machines 94 | 95 | The following PowerShell aliases apply to Virtual Machine commands. 96 | 97 | - **nazvmc** - New-AzureVMConfig 98 | 99 | 100 | ### Azure Storage 101 | 102 | - **nazsa** - New-AzureStorageAccount 103 | - **razsa** - Remove-AzureStorageAccount 104 | 105 | ## Auto-Completion 106 | 107 | Auto-completers are PowerShell ScriptBlocks that provide Intellisense & tab-completion for PowerShell command parameter values. 108 | These functions require the presence of the `Register-ArgumentCompleter` PowerShell command, which is available in PowerShell version 5.0. 109 | 110 | **NOTE**: The AzureExt module **must** be imported in order for the Intellisense extensions to be registered. 111 | To simplify this process, each time you launch a new PowerShell session, you can add a line to your PowerShell profile to import the module: 112 | 113 | ``` 114 | Import-Module -Name AzureExt; 115 | Start-AzureRm; 116 | ``` 117 | 118 | **IMPORTANT**: For most argument completer functions, you must be authenticated to Microsoft Azure. 119 | Starting with the 1.0 release of the Azure Resource Manager module, token caches are not automatically saved between PowerShell sessions. To simplify the process of authenticating each time you login, we created a command called `Start-AzureRm`. 120 | 121 | For Azure Service Management commands, use `Add-AzureAccount` to login. 122 | For Azure Resource Manager commands, use `Login-AzureRmAccount` to login. 123 | 124 | This module includes auto-completion for the following Azure entitites. 125 | 126 | ### Service Management 127 | 128 | - Subscription names 129 | - Cloud Service names 130 | - Virtual Machine names 131 | 132 | ### Resource Manager 133 | 134 | - Azure Locations 135 | - Resource Group names 136 | - Virtual Machine names 137 | - Storage Accounts 138 | - Resource Name, Resource Type, Resource Group Name for generic ARM "resource" commands 139 | 140 | ## Snippets 141 | 142 | The AzureExt module provides a number of useful PowerShell code snippets that can be used in the PowerShell Integrated Scripting Editor (ISE). Snippets are provided for things such as: 143 | 144 | - JSON declaration of Azure Resource Manager (ARM) resources 145 | - For example, you could build an ARM JSON Template in a PowerShell here-string, without leaving the ISE 146 | - Deploy an Azure Resource Manager (ARM) JSON Template 147 | 148 | To utilize these code snippets, run the following commands: 149 | 150 | ``` 151 | Import-Module -Name AzureExt; 152 | Import-IseSnippet -Module AzureExt; 153 | ``` 154 | 155 | ## Built-in Help 156 | 157 | # Authors 158 | 159 | The founder of this project is [Trevor Sullivan](https://trevorsullivan.net). 160 | 161 | # Contributing 162 | 163 | You can participate in the development of the Azure PowerShell Extensions module in a variety of different ways. 164 | 165 | ## Issues / Enhancements 166 | 167 | You can report bugs or feature enhancements on the GitHub Issue Tracker. 168 | 169 | ## Chat 170 | 171 | You can participate in project chat using the Gitter service. 172 | 173 | [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/pcgeek86/azure-powershell-extensions?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) 174 | 175 | ## Pull Requests 176 | 177 | If you want to add a feature and submit a Pull Request, feel free to. 178 | Simply fork the project into your own repository, commit to a new branch, and then submit a Pull Request targeting the `master` branch of this project. 179 | -------------------------------------------------------------------------------- /Snippets/arm-automation-create-account.snippets.ps1xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | arm-automation-create-account 6 | This snippet enables you to rapidly deploy a Microsoft Azure Resource Manager (ARM) Automation Account. 7 | Trevor Sullivan <trevor@trevorsullivan.net> 8 | 9 | Expansion 10 | 11 |
12 | 13 | 14 | 28 | 29 | 30 |
31 |
32 | 33 | -------------------------------------------------------------------------------- /Snippets/arm-automation-import-runbook.snippets.ps1xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | arm-automation-import-runbook 6 | This snippet enables you to rapidly import a Microsoft Azure Resource Manager (ARM) Automation Runbook. 7 | Trevor Sullivan <trevor@trevorsullivan.net> 8 | 9 | Expansion 10 | 11 |
12 | 13 | 14 | 26 | 27 |
28 |
29 | 30 | -------------------------------------------------------------------------------- /Snippets/arm-core-authenticate.snippets.ps1xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | arm-core-authenticate 6 | This snippet enables you to rapidly authenticate to Microsoft Azure Resource Manager (ARM) using Azure Active Directory (AAD). 7 | Trevor Sullivan <trevor@trevorsullivan.net> 8 | 9 | Expansion 10 | 11 |
12 | 13 | 14 | 20 | 21 | 22 |
23 |
24 | 25 | -------------------------------------------------------------------------------- /Snippets/arm-core-deploytemplate.snippets.ps1xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | arm-core-deploytemplate 6 | This snippet enables you to rapidly deploy a Microsoft Azure Resource Manager (ARM) JSON Template. 7 | Trevor Sullivan <trevor@trevorsullivan.net> 8 | 9 | Expansion 10 | 11 |
12 | 13 | 14 | 47 | 48 | 49 |
50 |
51 | 52 | -------------------------------------------------------------------------------- /Snippets/arm-core-resourcegroup.snippets.ps1xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | arm-core-resourcegroup 6 | This snippet enables you to rapidly deploy a Microsoft Azure Resource Manager (ARM) Resource Group. 7 | Trevor Sullivan <trevor@trevorsullivan.net> 8 | 9 | Expansion 10 | 11 |
12 | 13 | 14 | 22 | 23 |
24 |
25 | 26 | -------------------------------------------------------------------------------- /Snippets/arm-json-availabilityset.snippets.ps1xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | arm-json-availabilityset 6 | This snippet adds a Microsoft Azure Resource Manager (ARM) Availability Set resource. 7 | Trevor Sullivan <trevor@trevorsullivan.net 8 | 9 | Expansion 10 | 11 |
12 | 13 | 14 | 26 | 27 | 28 |
29 |
30 | 31 | -------------------------------------------------------------------------------- /Snippets/arm-json-documentdb.snippets.ps1xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | arm-json-documentdb 6 | This snippet adds a Microsoft Azure Resource Manager (ARM) DocumentDB resource. 7 | Trevor Sullivan <trevor@trevorsullivan.net 8 | 9 | Expansion 10 | 11 |
12 | 13 | 14 | 31 | 32 | 33 |
34 |
35 | 36 | -------------------------------------------------------------------------------- /Snippets/arm-json-networkinterface.snippets.ps1xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | arm-json-networkinterface 6 | This snippet adds a Microsoft Azure Resource Manager (ARM) Network Interface resource. 7 | Trevor Sullivan <trevor@trevorsullivan.net 8 | 9 | Expansion 10 | 11 |
12 | 13 | 14 | 55 | 56 | 57 |
58 |
59 | 60 | -------------------------------------------------------------------------------- /Snippets/arm-json-networksecuritygroup.snippets.ps1xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | arm-json-networksecuritygroup 6 | This snippet adds a Microsoft Azure Resource Manager (ARM) Network Security Group (NSG) resource. 7 | Trevor Sullivan <trevor@trevorsullivan.net 8 | 9 | Expansion 10 | 11 |
12 | 13 | 14 | 40 | 41 | 42 |
43 |
44 | 45 | -------------------------------------------------------------------------------- /Snippets/arm-json-parameter.snippets.ps1xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | arm-json-parameter 6 | This snippet adds a Microsoft Azure Resource Manager (ARM) JSON Template parameter. 7 | Trevor Sullivan <trevor@trevorsullivan.net 8 | 9 | Expansion 10 | 11 |
12 | 13 | 14 | 31 | 32 | 33 |
34 |
35 | 36 | -------------------------------------------------------------------------------- /Snippets/arm-json-publicipaddress.snippets.ps1xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | arm-json-publicipaddress 6 | This snippet adds a Microsoft Azure Resource Manager (ARM) Public IP Address resource. 7 | Trevor Sullivan <trevor@trevorsullivan.net 8 | 9 | Expansion 10 | 11 |
12 | 13 | 14 | 28 | 29 | 30 |
31 |
32 | 33 | -------------------------------------------------------------------------------- /Snippets/arm-json-rediscache.snippets.ps1xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | arm-json-rediscache 6 | This snippet adds a Microsoft Azure Resource Manager (ARM) Redis Cache resource to an ARM JSON Template. 7 | Trevor Sullivan <trevor@trevorsullivan.net 8 | 9 | Expansion 10 | 11 |
12 | 13 | 14 | 34 | 35 | 36 |
37 |
38 | 39 | -------------------------------------------------------------------------------- /Snippets/arm-json-storageaccount.snippets.ps1xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | arm-json-storageaccount 6 | This snippet adds a Microsoft Azure Storage Account resource. 7 | 8 | 9 | Expansion 10 | 11 |
12 | 13 | 14 | 25 | 26 | 27 |
28 |
29 | 30 | -------------------------------------------------------------------------------- /Snippets/arm-json-template.snippets.ps1xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | arm-json-template 6 | This snippet adds the basic structure for a Microsoft Azure Resource Manager (ARM) JSON Template. 7 | 8 | 9 | Expansion 10 | 11 |
12 | 13 | 14 | 24 | 25 | 26 |
27 |
28 | 29 | -------------------------------------------------------------------------------- /Snippets/arm-json-variable.snippets.ps1xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | arm-json-variable 6 | This snippet adds a Microsoft Azure Resource Manager (ARM) JSON Template variable. 7 | Trevor Sullivan <trevor@trevorsullivan.net 8 | 9 | Expansion 10 | 11 |
12 | 13 | 14 | 20 | 21 | 22 |
23 |
24 | 25 | -------------------------------------------------------------------------------- /Snippets/arm-json-virtualnetwork.snippets.ps1xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | arm-json-virtualnetwork 6 | This snippet adds a Microsoft Azure Resource Manager (ARM) Virtual Network resource. 7 | Trevor Sullivan <trevor@trevorsullivan.net 8 | 9 | Expansion 10 | 11 |
12 | 13 | 14 | 56 | 57 | 58 |
59 |
60 | 61 | -------------------------------------------------------------------------------- /Tests/AzureExt.AutoCompletion.ManualTest.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Helper script for testing Microsoft Azure argument-completer functions. 4 | #> 5 | #$VerbosePreference = 'continue'; 6 | $AzureUsername = 'trevor@trevorsullivan.net'; 7 | $AzureCredential = Get-Credential -UserName $AzureUsername -Message 'Please enter your Microsoft Azure password.'; 8 | $AzureProfile = Login-AzureRMAccount -Credential $AzureCredential; 9 | 10 | Import-Module -Name AzureExt -Force; 11 | 12 | ### Now test the argument completer(s). If changes are made simply re-run the script. 13 | 14 | -------------------------------------------------------------------------------- /Tests/AzureExt.tests.ps1: -------------------------------------------------------------------------------- 1 | # 2 | # This is a PowerShell Unit Test file. 3 | # You need a unit test framework such as Pester to run PowerShell Unit tests. 4 | # You can download Pester from http://go.microsoft.com/fwlink/?LinkID=534084 5 | # 6 | 7 | Describe -Name Aliases -Fixture { 8 | Context 'Aliases Should Exist' { 9 | It "Should Return" { 10 | 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | ### AppVeyor.yml Build Configuration file 2 | 3 | branches: 4 | only: 5 | - production 6 | 7 | ### Disable the build process 8 | build: off 9 | 10 | os: "WMF 5" 11 | 12 | clone_folder: c:\repos\AzureExt 13 | 14 | environment: 15 | PSGalleryApiKey: 16 | secure: SlvbZKurugx1nGHlyk6VB1dXh3IJOWsY/Ds2bGBpknpze8R3os5pHGmPeyJXHv9K 17 | 18 | deploy_script: 19 | ### Fix for NuGet 3.4+ issue. Downgrades to NuGet 3.3.0 20 | - ps: Write-Host -NoNewline "Installing NuGet 3.3.0..." 21 | - ps: if (Test-Path 'C:\Tools\NuGet3') { $nugetDir = 'C:\Tools\NuGet3' } else { $nugetDir = 'C:\Tools\NuGet' } 22 | - ps: (New-Object Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/v3.3.0/nuget.exe', "$nugetDir\NuGet.exe") 23 | - ps: Write-Host "OK" -ForegroundColor Green 24 | ### 25 | 26 | - ps: . "$env:APPVEYOR_BUILD_FOLDER\Patch-ModuleManifest.ps1"; 27 | - ps: Patch-ModuleManifest -BuildNumber $env:APPVEYOR_BUILD_NUMBER; 28 | - ps: try { Find-Package -Name zzzzzzzzzzzzz -Force -ForceBootstrap -ErrorAction Stop; } catch { Write-Warning -Message 'Finished bootstrap.'; }; 29 | - ps: Publish-Module -NuGetApiKey $env:PSGalleryApiKey -Path $env:APPVEYOR_BUILD_FOLDER -Confirm:$false; 30 | 31 | -------------------------------------------------------------------------------- /en-us/README.md: -------------------------------------------------------------------------------- 1 | This folder contains the help files for the Azure PowerShell Extensions project. 2 | 3 | [This document](https://technet.microsoft.com/en-us/library/dd878343(v=vs.85).aspx) describes the process of adding help to PowerShell modules. 4 | 5 | There are five differnt types of module help in PowerShell: 6 | 7 | **Cmdlet Help**. The Help topics that describe cmdlets in a module are XML files that use the command help schema. 8 | 9 | **Provider Help**. The Help topics that describe providers in a module are XML files that use the provider help schema. 10 | 11 | **Function Help**. The Help topics that describe functions in a module can be XML files that use the command help schema or comment-based Help topics within the function, or the script or script module. 12 | 13 | **Script Help**. The Help topics that describe scripts in a module can be XML files that use the command help schema or comment-based Help topics in the script or script module. 14 | 15 | **Conceptual ("About") Help**. You can use a conceptual ("about") Help topic to describe the module and its members and to explain how the members can be used together to perform tasks. Conceptual Help topics are text files with Unicode (UTF-8) encoding. The file name must use the *about_.help.txt format*, such as *about_MyModule.help.txt*. By default, Windows PowerShell includes over 100 of these conceptual About Help topics. -------------------------------------------------------------------------------- /en-us/about_AzureExtensions.help.txt: -------------------------------------------------------------------------------- 1 | TOPIC 2 | about_AzureExtensions 3 | 4 | SHORT DESCRIPTION 5 | This help topic describes the Azure Extensions PowerShell module, and the enhancements 6 | it provides on top of the core Azure PowerShell experience. 7 | 8 | LONG DESCRIPTION 9 | The Microsoft Azure PowerShell module actually offers two different modules: Azure Service Management (ASM) 10 | and Azure Resource Manager (ARM). These modules are generally well-done, however there are some usability 11 | enhancements that are intended to be fulfilled through this Azure Extensions module. 12 | 13 | The Azure Extensions module will offer additional functionality, including: 14 | 15 | - PowerShell command aliases, to simplify interactive use of core Azure PowerShell commands 16 | - PowerShell built-in about_* documentation topics 17 | - PowerShell types.ps1xml files, to help format object output 18 | - PowerShell 19 | 20 | EXAMPLES 21 | Examples of how to use the module or how the subject feature works in practice. 22 | 23 | KEYWORDS 24 | Terms or titles on which you might expect your users to search for the information in this topic. 25 | 26 | SEE ALSO 27 | Text-only references for further reading. Hyperlinks cannot work in the Windows PowerShell console. 28 | 29 | --------------------------------------------------------------------------------