Reputation: 881
I'm observing the following behavior when trying to retrieve Automation modules from automation account using Get-AzureRmAutomationModule cmdlet.
When using the cmdlet with only 2 parameters (ResourceGroupName and AutomationAccountName), the modules list shows Version as null for the "global" modules. However, when running the same cmdlet by passing 3 parameters (ResourceGroupName, AutomationAccountName, and Module name), we get the version for the global modules.
Is this as designed and if so, why is it in this way? Currently, the portal also shows version as null for the global modules when in fact they have a version already. Some sample modules where this behavior is seen are listed below.
AuditPolicyDsc
PSDscResources
SecurityPolicyDsc
StateConfigCompositeResources
xDSCDomainjoin
xPowerShellExecutionPolicy
xRemoteDesktopAdmin
Thanks!
Upvotes: 0
Views: 156
Reputation: 42063
Here are some personal opinions for you to refer, I think it may be a bug of the API.
First, I check it in the portal and test the command, the result is like you mentioned, but the command is essentially an API. So I check my automation account in the azure resource explorer(choose the AuditPolicyDsc
module for sample).
Check all the modules:
Check only the AuditPolicyDsc
module:
You could find the AuditPolicyDsc
module, not only the version
, but also the sizeInBytes
and activityCount
are different.
Note: Also, I think it may not be related to global, you could find a module named Microsoft.PowerShell.Core
, it is global but the version is not null.
They use two different API, I think it may caused by them, otherwise it may be unreasonable.
https://management.azure.com/subscriptions/{subscriptionid}/resourceGroups/{resourceGroup}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/modules?api-version=2015-10-31
https://management.azure.com/subscriptions/{subscriptionid}/resourceGroups/{resourceGroup}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/modules/AuditPolicyDsc?api-version=2015-10-31
If you want to improve it, I think you could post idea in the automation feedback, it may be helpful.
Upvotes: 1