Using PowerShell to create a custom reference for Azure PowerShell cmdlets and parameters

I was looking into the list of Azure PowerShell cmdlets and I could not find a page with all cmdlets and parameters in a single list. There are individual pages for each cmdlet on TechNet, but not all cmdlets in one page. There is a list of all cmdlets in one page, but that does not include the parameters as well.

However, since we have the Get-Command and Get-Help cmdlets, that is something that we can solve by writing a script. So, after installing the latest (as of 11/14/14) Azure PowerShell cmdlets, I wrote a little script to output all cmdlet names and parameters to HTML. Here’s that script:

 

$Cmdlet = "" | Select Name, Parameters
Get-command -Module Azure | % {
Get-Help $_ | % {
$ParameterSetCount = 1
$CmdletName = $_.Name
$ParameterSets = $_.syntax.syntaxItem
$ParameterSets | % {

      $Cmdlet.Name=$CmdletName
If ($ParameterSets.Count -gt 1) {
$Cmdlet.Name+=” (“+$ParameterSetCount+”)”
$ParameterSetCount++
}

      $Parameters = $_.parameter
$StringPar=””
If ($Parameters) {
$First=$true
$Parameters | % {
If ($First) {$First=$false} else {$StringPar+="%%"}
$StringPar+= “ -“+$_.name+” “;
if ($_.parameterValue -and ($_.parameterValue –notlike “Switch*”)) {
$StringPar+= ”<”+$_.parameterValue+”> “
}
}
}
$StringPar=$StringPar.Replace(“Nullable``1”,””)
$StringPar=$StringPar.Replace(“System.[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]”,”Int32”)
$StringPar=$StringPar.Replace(“System.[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]”,”Boolean”)
$Cmdlet.parameters=$StringPar;

      $Cmdlet
}
}
} | ConvertTo-HTML | Out-File D:AzureCmdlets.HTML

 

I ended up having to make a few adjustments to make things work better for my specific purpose:

  • If a cmdlet has more than one form (more than one parameter set), I listed them with a number next to the cmdlet name
  • I added the data type next to the parameter name, enclosed in <angle brackets> (except for switch parameters)
  • Certain data types were showing some additional info that I did not need (like “Nullable”), which I removed
  • The script adds a “%%” mark between parameters. I later replaced those with HTML line breaks (“<BR>”)

 

Here is the output of the script, with some minor adjustments to the HTML:

Name Parameters
Add-AzureEnvironment -Name <String>-PublishSettingsFileUrl <String>-ServiceEndpoint <String>-ManagementPortalUrl <String>-StorageEndpoint <String>-ActiveDirectoryEndpoint <String>-ResourceManagerEndpoint <String>-GalleryEndpoint <String>
Disable-AzureWebsiteApplicationDiagnostic -Name <String>-File-Storage-PassThru-Slot <String>
Enable-AzureWebsiteApplicationDiagnostic -Name <String>-File-Storage <String>-StorageAccountName <String>-LogLevel <String>-PassThru-Slot <String>
Get-AzureStorageContainer (1) -Name <String>-MaxCount <[Int32]>-ContinuationToken <BlobContinuationToken>-Context <AzureStorageContext>-ServerTimeoutPerRequest <[Int32]>-ClientTimeoutPerRequest <[Int32]>-ConcurrentTaskCount <[Int32]>
Get-AzureStorageContainer (2) -Prefix <String>-MaxCount <[Int32]>-ContinuationToken <BlobContinuationToken>-Context <AzureStorageContext>-ServerTimeoutPerRequest <[Int32]>-ClientTimeoutPerRequest <[Int32]>-ConcurrentTaskCount <[Int32]>
Get-AzureEnvironment -Name <String>
Get-AzurePublishSettingsFile -Realm <String>-Environment <String>
Get-AzureSBLocation  
Get-AzureSBNamespace -Name <String>
Get-AzureSubscription (1) -SubscriptionName <String>-ExtendedDetails-SubscriptionDataFile <String>
Get-AzureSubscription (2) -Current-ExtendedDetails-SubscriptionDataFile <String>
Get-AzureSubscription (3) -Default-ExtendedDetails-SubscriptionDataFile <String>
Get-AzureWebsite -Name <String>-Slot <String>
Get-AzureWebsiteDeployment -CommitId <String>-MaxResults <Int32>-Details-Name <String>-Slot <String>
Get-AzureWebsiteLocation  
Get-AzureWebsiteLog -Name <String>-Path <String>-Message <String>-Tail-ListPath-Slot <String>
Import-AzurePublishSettingsFile -PublishSettingsFile <String>-SubscriptionDataFile <String>
Invoke-AzureHDInsightHiveJob -Arguments <String[]>-Defines <Hashtable>-File <String>-Files <String[]>-JobName <String>-Query <String>-StatusFolder <String>
New-AzureSBNamespace -Name <String>-Location <String>-CreateACSNamespace <Boolean>-NamespaceType <NamespaceType>
New-AzureWebsite -Location <String>-Hostname <String>-PublishingUsername <String>-Git-GitHub-GithubCredentials <PSCredential>-GithubRepository <String>-Name <String>-Slot <String>
Remove-AzureEnvironment -Name <String>-PassThru <String>
Remove-AzureSBNamespace -Name <String>
Remove-AzureSubscription -SubscriptionName <String>-Force-PassThru-SubscriptionDataFile <String>-Confirm-WhatIf
Remove-AzureWebsite -Force-Name <String>-Slot <String>
Restart-AzureWebsite -Name <String>
Restore-AzureWebsiteDeployment -CommitId <String>-Force-Name <String>-WhatIf-Confirm-Slot <String>
Save-AzureWebsiteLog -Output <String>-Name <String>-Slot <String>
Select-AzureSubscription (1) -SubscriptionName <String>-Current-PassThru-SubscriptionDataFile <String>
Select-AzureSubscription (2) -SubscriptionName <String>-PassThru-SubscriptionDataFile <String>-Default
Select-AzureSubscription (3) -PassThru-SubscriptionDataFile <String>-NoCurrent
Select-AzureSubscription (4) -PassThru-SubscriptionDataFile <String>-NoDefault
Set-AzureEnvironment -Name <String>-PublishSettingsFileUrl <String>-ServiceEndpoint <String>-ManagementPortalUrl <String>-StorageEndpoint <String>-ActiveDirectoryEndpoint <String>-ResourceManagerEndpoint <String>-GalleryEndpoint <String>
Set-AzureSubscription (1) -SubscriptionName <String>-Certificate <X509Certificate2>-CurrentStorageAccountName <String>-PassThru-ResourceManagerEndpoint <String>-ServiceEndpoint <String>-SubscriptionDataFile <String>-SubscriptionId <String>
Set-AzureSubscription (2) -SubscriptionName <String>-PassThru-SubscriptionDataFile <String>
Set-AzureWebsite -NumberOfWorkers <Int32>-DefaultDocuments <String[]>-NetFrameworkVersion <String>-PhpVersion <String>-RequestTracingEnabled <Boolean>-HttpLoggingEnabled <Boolean>-DetailedErrorLoggingEnabled <Boolean>-HostNames <String[]>-AppSettings <Hashtable>-Metadata <NameValuePair>-ConnectionStrings <ConnStringPropertyBag>-HandlerMappings <HandlerMapping[]>-SiteWithConfig <SiteWithConfig>-Name <String>-PassThru-ManagedPipelineMode <String>-WebSocketsEnabled <String>-Slot <String>-RoutingRules <Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities.RampUpRule>-Use32BitWorkerProcess <Boolean>
Show-AzurePortal -Name <String>-Realm <String>-Environment <String>
Show-AzureWebsite -Name <String>-Slot <String>
Start-AzureStorageBlobCopy (1) -SrcBlob <String>-SrcContainer <String>-DestContainer <String>-DestBlob <String>-Context <AzureStorageContext>-DestContext <AzureStorageContext>-Force-ServerTimeoutPerRequest <[Int32]>-ClientTimeoutPerRequest <[Int32]>-ConcurrentTaskCount <[Int32]>
Start-AzureStorageBlobCopy (2) -ICloudBlob <ICloudBlob>-DestICloudBlob <ICloudBlob>-Context <AzureStorageContext>-DestContext <AzureStorageContext>-Force-ServerTimeoutPerRequest <[Int32]>-ClientTimeoutPerRequest <[Int32]>-ConcurrentTaskCount <[Int32]>
Start-AzureStorageBlobCopy (3) -ICloudBlob <ICloudBlob>-DestContainer <String>-DestBlob <String>-Context <AzureStorageContext>-DestContext <AzureStorageContext>-Force-ServerTimeoutPerRequest <[Int32]>-ClientTimeoutPerRequest <[Int32]>-ConcurrentTaskCount <[Int32]>
Start-AzureStorageBlobCopy (4) -CloudBlobContainer <CloudBlobContainer>-SrcBlob <String>-DestContainer <String>-DestBlob <String>-Context <AzureStorageContext>-DestContext <AzureStorageContext>-Force-ServerTimeoutPerRequest <[Int32]>-ClientTimeoutPerRequest <[Int32]>-ConcurrentTaskCount <[Int32]>
Start-AzureStorageBlobCopy (5) -AbsoluteUri <String>-DestContainer <String>-DestBlob <String>-Context <AzureStorageContext>-DestContext <AzureStorageContext>-Force-ServerTimeoutPerRequest <[Int32]>-ClientTimeoutPerRequest <[Int32]>-ConcurrentTaskCount <[Int32]>
Start-AzureWebsite -Name <String>-Slot <String>
Stop-AzureStorageBlobCopy (1) -Blob <String>-Container <String>-Force-CopyId <String>-Context <AzureStorageContext>-ServerTimeoutPerRequest <[Int32]>-ClientTimeoutPerRequest <[Int32]>-ConcurrentTaskCount <[Int32]>
Stop-AzureStorageBlobCopy (2) -ICloudBlob <ICloudBlob>-Force-CopyId <String>-Context <AzureStorageContext>-ServerTimeoutPerRequest <[Int32]>-ClientTimeoutPerRequest <[Int32]>-ConcurrentTaskCount <[Int32]>
Stop-AzureStorageBlobCopy (3) -CloudBlobContainer <CloudBlobContainer>-Blob <String>-Force-CopyId <String>-Context <AzureStorageContext>-ServerTimeoutPerRequest <[Int32]>-ClientTimeoutPerRequest <[Int32]>-ConcurrentTaskCount <[Int32]>
Stop-AzureWebsite -Name <String>-Slot <String>
Test-AzureName (1) -Service-Name <String>
Test-AzureName (2) -Storage-Name <String>
Test-AzureName (3) -ServiceBusNamespace-Name <String>
Test-AzureName (4) -Website-Name <String>
Add-AzureAccount -Credential <PSCredential>-Environment <String>-SubscriptionDataFile <String>
Add-AzureCacheWorkerRole -Name <String>-Instances <Int32>
Add-AzureCertificate -ServiceName <String>-CertToDeploy <Object>-Password <String>
Add-AzureDataDisk (1) -CreateNew-DiskSizeInGB <Int32>-DiskLabel <String>-LUN <Int32>-MediaLocation <String>-HostCaching <String>-VM <IPersistentVM>
Add-AzureDataDisk (2) -Import-DiskName <String>-LUN <Int32>-HostCaching <String>-VM <IPersistentVM>
Add-AzureDataDisk (3) -ImportFrom-DiskLabel <String>-LUN <Int32>-MediaLocation <String>-HostCaching <String>-VM <IPersistentVM>
Add-AzureDisk -DiskName <String>-MediaLocation <String>-Label <String>-OS <String>
Add-AzureDjangoWebRole -Name <String>-Instances <Int32>
Add-AzureDns -Name <String>-IPAddress <String>-ServiceName <String>
Add-AzureEndpoint (1) -Name <string>-Protocol <string>-LocalPort <int>-DefaultProbe-LBSetName <string>-ProbePort <int>-ProbeProtocol <string>-VM <IPersistentVM>-ACL <NetworkAclObject>-DirectServerReturn <Boolean>-IdleTimeoutInMinutes <Int32>-InternalLoadBalancerName <string>-LoadBalancerDistribution <string>-PipelineVariable <string>-ProbeIntervalInSeconds <Int32>-ProbePath <string>-ProbeTimeoutInSeconds <Int32>-PublicPort <Int32>
Add-AzureEndpoint (2) -Name <string>-Protocol <string>-LocalPort <int>-NoProbe-VM <IPersistentVM>-ACL <NetworkAclObject>-DirectServerReturn <Boolean>-IdleTimeoutInMinutes <Int32>-InternalLoadBalancerName <string>-LoadBalancerDistribution <string>-PipelineVariable <string>-PublicPort <Int32>
Add-AzureEnvironment -Name <String>-PublishSettingsFileUrl <String>-ServiceEndpoint <String>-ManagementPortalUrl <String>-StorageEndpoint <String>-ActiveDirectoryEndpoint <String>-ResourceManagerEndpoint <String>-GalleryEndpoint <String>
Add-AzureHDInsightConfigValues -Config <AzureHDInsightConfig>-Core <Hashtable>-Yarn <Hashtable>-Hdfs <Hashtable>-Hive <AzureHDInsightHiveConfiguration>-MapReduce <AzureHDInsightMapReduceConfiguration>-Oozie <AzureHDInsightOozieConfiguration>-Storm <Hashtable>-HBase <AzureHDInsightHBaseConfiguration>
Add-AzureHDInsightMetastore -Config <AzureHDInsightConfig>-Credential <PSCredential>-DatabaseName <String>-MetastoreType <AzureHDInsightMetastoreType>-SqlAzureServerName <String>
Add-AzureHDInsightStorage -Config <AzureHDInsightConfig>-StorageAccountKey <String>-StorageAccountName <String>
Add-AzureInternalLoadBalancer (1) -InternalLoadBalancerName <String>-ServiceName <String>
Add-AzureInternalLoadBalancer (2) -InternalLoadBalancerName <String>-ServiceName <String>-SubnetName <String>-StaticVNetIPAddress <IPAddress>
Add-AzureInternalLoadBalancer (3) -InternalLoadBalancerName <String>-ServiceName <String>-SubnetName <String>
Add-AzureNetworkInterfaceConfig -Name <string>-SubnetName <string>-StaticVNetIPAddress <string>-VM <IPersistentVM>
Add-AzureNodeWebRole -Name <String>-Instances <Int32>
Add-AzureNodeWorkerRole -Name <String>-Instances <Int32>
Add-AzurePHPWebRole -Name <String>-Instances <Int32>
Add-AzurePHPWorkerRole -Name <String>-Instances <Int32>
Add-AzureProvisioningConfig (1) -VM <IPersistentVM>-DisableGuestAgent-CustomDataFile <String>-Windows-AdminUsername <String>-Password <String>-ResetPasswordOnFirstLogon-DisableAutomaticUpdates-NoRDPEndpoint-TimeZone <String>-Certificates <CertificateSettingList>-EnableWinRMHttp-DisableWinRMHttps-WinRMCertificate <X509Certificate2>-X509Certificates <X509Certificate2[]>-NoExportPrivateKey-NoWinRMEndpoint
Add-AzureProvisioningConfig (2) -VM <IPersistentVM>-DisableGuestAgent-Linux-LinuxUser <String>-DisableSSH-NoSSHEndpoint-NoSSHPassword-SSHPublicKeys <LinuxProvisioningConfigurationSet+SSHPublicKeyList>-SSHKeyPairs <LinuxProvisioningConfigurationSet+SSHKeyPairList>-CustomDataFile <String>-Password <String>
Add-AzureProvisioningConfig (3) -VM <IPersistentVM>-DisableGuestAgent-CustomDataFile <String>-AdminUsername <String>-WindowsDomain-Password <String>-ResetPasswordOnFirstLogon-DisableAutomaticUpdates-NoRDPEndpoint-TimeZone <String>-Certificates <CertificateSettingList>-JoinDomain <String>-Domain <String>-DomainUserName <String>-DomainPassword <String>-MachineObjectOU <String>-EnableWinRMHttp-DisableWinRMHttps-WinRMCertificate <X509Certificate2>-X509Certificates <X509Certificate2[]>-NoExportPrivateKey-NoWinRMEndpoint
Add-AzureTrafficManagerEndpoint -DomainName <String>-Location <String>-Type <String>-Status <String>-Weight <[Int32]>-MinChildEndpoints <[Int32]>-TrafficManagerProfile <IProfileWithDefinition>
Add-AzureVhd -Destination <Uri>-LocalFilePath <FileInfo>-NumberOfUploaderThreads <Int32>-BaseImageUriToPatch <Uri>-OverWrite
Add-AzureVMImage -ImageName <String>-MediaLocation <String>-OS <String>-Label <String>-Eula <String>-Description <String>-ImageFamily <String>-PublishedDate <[DateTime]>-PrivacyUri <Uri>-RecommendedVMSize <String>
Add-AzureWebRole -Name <String>-Instances <Int32>-TemplateFolder <String>
Add-AzureWorkerRole -Name <String>-Instances <Int32>-TemplateFolder <String>
Disable-AzureServiceProjectRemoteDesktop  
Disable-AzureTrafficManagerProfile -Name <String>-PassThru
Disable-AzureWebsiteApplicationDiagnostic -Name <String>-File-Storage-PassThru-Slot <String>
Disable-AzureWebsiteDebug -Name <String>-Slot <String>-PassThru
Enable-AzureMemcacheRole -RoleName <String>-CacheWorkerRoleName <String>-CacheRuntimeVersion <String>
Enable-AzureServiceProjectRemoteDesktop -Username <String>-Password <SecureString>
Enable-AzureTrafficManagerProfile -Name <String>-PassThru
Enable-AzureWebsiteApplicationDiagnostic -Name <String>-File-Storage <String>-StorageAccountName <String>-LogLevel <String>-PassThru-Slot <String>
Enable-AzureWebsiteDebug -Name <String>-Slot <String>-Version <String>-PassThru
Export-AzureVM -ServiceName <String>-Name <String>-Path <String>
Get-AzureAccount -Name <String>-SubscriptionDataFile <String>
Get-AzureAclConfig -EndpointName <String>-VM <IPersistentVM>
Get-AzureAffinityGroup -Name <String>
Get-AzureAutomationAccount -Name <String>-Location <String>
Get-AzureAutomationJob (1) -AutomationAccountName <String>-EndTime <DateTime>-StartTime <DateTime>
Get-AzureAutomationJob (2) -AutomationAccountName <String>-Id <Guid>
Get-AzureAutomationJob (3) -AutomationAccountName <String>-EndTime <DateTime>-StartTime <DateTime>-RunbookId <Guid>
Get-AzureAutomationJob (4) -AutomationAccountName <String>-EndTime <DateTime>-StartTime <DateTime>-RunbookName <String>
Get-AzureAutomationJobOutput -AutomationAccountName <String>-Id <Guid>-StartTime <DateTime>-Stream <String>
Get-AzureAutomationRunbook (1) -AutomationAccountName <String>
Get-AzureAutomationRunbook (2) -AutomationAccountName <String>-Id <Guid>
Get-AzureAutomationRunbook (3) -AutomationAccountName <String>-Name <String>
Get-AzureAutomationRunbook (4) -AutomationAccountName <String>-ScheduleName <String>
Get-AzureAutomationRunbookDefinition (1) -AutomationAccountName <String>-Slot <String>-Name <String>
Get-AzureAutomationRunbookDefinition (2) -AutomationAccountName <String>-Slot <String>-Id <Guid>
Get-AzureAutomationRunbookDefinition (3) -AutomationAccountName <String>-Slot <String>-VersionId <Guid>
Get-AzureAutomationSchedule (1) -AutomationAccountName <String>
Get-AzureAutomationSchedule (2) -AutomationAccountName <String>-Id <Guid>
Get-AzureAutomationSchedule (3) -AutomationAccountName <String>-Name <String>
Get-AzureCertificate -ServiceName <String>-ThumbprintAlgorithm <String>-Thumbprint <String>
Get-AzureDataDisk -Lun <[Int32]>-VM <IPersistentVM>
Get-AzureDeployment -ServiceName <String>-Slot <String>
Get-AzureDeploymentEvent -EndTime <DateTime>-ServiceName <string>-StartTime <DateTime>
Get-AzureDisk -DiskName <String>
Get-AzureDns -DnsSettings <DnsSettings>
Get-AzureEndpoint -Name <String>-VM <IPersistentVM>
Get-AzureEnvironment -Name <String>
Get-AzureHDInsightCluster -Certificate <X509Certificate2>-HostedService <String>-Endpoint <Uri>-Name <String>-Subscription <String>
Get-AzureHDInsightJob (1) -Cluster <String>-Credential <PSCredential>-JobId <String>
Get-AzureHDInsightJob (2) -Certificate <X509Certificate2>-HostedService <String>-Cluster <String>-Endpoint <Uri>-JobId <String>-Subscription <String>
Get-AzureHDInsightJobOutput -Certificate <X509Certificate2>-HostedService <String>-Cluster <String>-DownloadTaskLogs-Endpoint <Uri>-JobId <String>-StandardError-StandardOutput-Subscription <String>-TaskLogsDirectory <String>-TaskSummary
Get-AzureHDInsightProperties -Certificate <X509Certificate2>-HostedService <String>-Endpoint <Uri>-Locations-Subscription <String>-Versions
Get-AzureInternalLoadBalancer -ServiceName <String>
Get-AzureLocation  
Get-AzureManagedCache -Name <String>
Get-AzureManagedCacheAccessKey -Name <String>
Get-AzureManagedCacheLocation  
Get-AzureMediaServicesAccount -Name <String>
Get-AzureNetworkInterfaceConfig -Name <string>-VM <PersistentVMRoleContext>
Get-AzureNetworkSecurityGroup -Name <string>-Detailed
Get-AzureNetworkSecurityGroupConfig -VM <IPersistentVM>-Detailed
Get-AzureNetworkSecurityGroupForSubnet -VirtualNetworkName <string>-SubnetName <string>-Detailed