azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Get-AzureRmAutomationModule doesn't return values for Version, SizeInBytes, and ActivityCount properties

Open alexandair opened this issue 10 years ago • 10 comments

Cmdlet(s)

Get-AzureRmAutomationModule

PowerShell Version

5.1.14300.1000

Module Version

2.2.0

OS Version

10.0.14300.1000

Description

If you specify a value for the -Name parameter, Get-AzureRmAutomationModule populates all property values. If you don't it (getting output for all modules), 3 properties are empty or set to 0: Version, SizeInBytes, and ActivityCount.

Debug Output

Instructions: to get Debug Output, set $DebugPreference="Continue" and then execute the cmdlet or script causing the issue

Script/Steps for Reproduction

PS C:\> get-azurermautomationmodule -AutomationAccountName demoautomation -ResourceGroupName demo-rg

ResourceGroupName     : demo-rg
AutomationAccountName : demoutomation
Name                  : Azure
IsGlobal              : True
Version               :
SizeInBytes           : 0
ActivityCount         : 0
CreationTime          : 3/18/2014 11:02:40 PM +00:00
LastModifiedTime      : 9/23/2016 4:42:50 PM +00:00
ProvisioningState     : Created

#specify a value for the -Name parameter
PS C:\> get-azurermautomationmodule -AutomationAccountName demoautomation -ResourceGroupName demo-rg -Name azure

ResourceGroupName     : demo-rg
AutomationAccountName : demoautomation
Name                  : Azure
IsGlobal              : True
Version               : 1.0.3
SizeInBytes           : 41338511
ActivityCount         : 673
CreationTime          : 3/18/2014 11:02:40 PM +00:00
LastModifiedTime      : 9/23/2016 4:44:28 PM +00:00
ProvisioningState     : Created

alexandair avatar Oct 02 '16 22:10 alexandair

@eamonoreilly Hey Eamon, would you mind taking a look at this issue?

cormacpayne avatar Oct 03 '16 16:10 cormacpayne

I'll have Safeer have a look. I think this is by design in that we only retrieve summary information about the modules if you don't specify a specific module name and you need to specify the name to get full details. We could probably exclude these properties when not doing a deep call to avoid any confusion. I'll let Safeer clarify one way or the other. Thanks, Eamon

eamonoreilly avatar Oct 03 '16 16:10 eamonoreilly

What Eamon mentioned is correct, we only retrieve summary information about the modules if a specific module name is not specified. Specifying the name will give all details. We did considered excluding these properties when not doing a deep call, but that was leading to different output type from the same cmdlet. We have in backlog to look at alternatives.

safeermohammed avatar Oct 03 '16 20:10 safeermohammed

I find that design decision not very user friendly. Finding info about versions for a bunch of modules at the same time shouldn't involve some additional commands (like when I want to check out Azure-related modules that I've updated). Especially since Portal is also missing a Version column and we need to click on any single module to find its version in the Portal. That's not optimal.

alexandair avatar Oct 04 '16 05:10 alexandair

We are looking into this. Meanwhile you can try this

$acc = Get-AzureRmAutomationAccount -ResourceGroupName $ResourceGroupName -Name $AutomationAccountName

$acc | Get-AzureRmAutomationModule | Get-AzureRmAutomationModule

safeermohammed avatar Oct 04 '16 21:10 safeermohammed

Smart workaround. Interestingly, it doesn't work for Microsoft.* modules.

alexandair avatar Oct 05 '16 04:10 alexandair

Module version is optional property and seems like Microsoft.* modules do not have versions as those are global modules injected in automation

$acc | Get-AzureRmAutomationModule -Name Microsoft.WSMan.Management

ResourceGroupName : ------- AutomationAccountName : ---------- Name : Microsoft.WSMan.Management IsGlobal : True Version : SizeInBytes : 4130 ActivityCount : 13 CreationTime : 10/2/2015 5:42:44 PM -07:00 LastModifiedTime : 10/3/2016 12:43:15 PM -07:00 ProvisioningState : Created

safeermohammed avatar Oct 06 '16 00:10 safeermohammed

Orchestrator.AssetManagement.Cmdlets is also a global module injected in automation and has a version value. Microsoft.PowerShell.Core is a snap-in (not a module) and has a wrong version 0.0.

PS C:\> $aa | get-azurermautomationmodule | get-azurermautomationmodule | ft name,version,isglobal -auto


Name                                 Version IsGlobal
----                                 ------- --------
Azure                                1.0.3       True
Azure.Storage                        1.0.3       True
AzureRM.Automation                   1.0.3       True
AzureRM.Compute                      1.2.1       True
AzureRM.Profile                      1.0.3       True
AzureRM.Resources                    1.0.3       True
AzureRM.Sql                          1.0.3       True
AzureRM.Storage                      1.0.3       True
Microsoft.PowerShell.Core            0.0         True
Microsoft.PowerShell.Diagnostics                 True
Microsoft.PowerShell.Management                  True
Microsoft.PowerShell.Security                    True
Microsoft.PowerShell.Utility                     True
Microsoft.WSMan.Management                       True
Orchestrator.AssetManagement.Cmdlets 1.0         True

alexandair avatar Oct 06 '16 04:10 alexandair

May be duplicate of #6846. Team will fix.

csand-msft avatar Feb 26 '19 01:02 csand-msft

With Az.Automation 1.3.7 (Az 4.6.1) the versions returned in PowerShell is consistent with the portal and include Version, SizeInBytes, and ActivityCount

Get-AzAutomationModule -ResourceGroupName automationrg -AutomationAccountName myautomation

ResourceGroupName     : automationrg
AutomationAccountName : myautomation
Name                  : AuditPolicyDsc
IsGlobal              : True
Version               : 1.1.0.0
SizeInBytes           : 205346
ActivityCount         : 3
CreationTime          : 1/31/2019 11:31:08 AM -08:00
LastModifiedTime      : 8/5/2020 10:40:01 PM -07:00
ProvisioningState     : Created

ResourceGroupName     : automationrg
AutomationAccountName : myautomation
Name                  : Az.Accounts
IsGlobal              : False
Version               : 1.9.3
SizeInBytes           : 5741522
ActivityCount         : 33
CreationTime          : 8/31/2020 5:14:21 PM -07:00
LastModifiedTime      : 8/31/2020 5:15:25 PM -07:00
ProvisioningState     : Succeeded

Only a handful of modules do not display any version in the portal nor in PowerShell. I'm closing this issue , please open a new one if needed.

dcaro avatar Sep 01 '20 00:09 dcaro