Azure / Azure/azure-powershell

Get-AZAutomationHybridWorkerGroup returns 0 results when run against an automation account

Open
#19,211 4 comments 0 reactions 0 assignees View on GitHub
act-codegen-extensibility-squad Automation customer-reported feature-request Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
3d 14h
Merged PRs (30d)
54

Description

### Description

when running the cmdlet 'Get-AZAutomationHybridWorkerGroup', no results are returned. The behavior is the same if I provide the RG and AA account names in-line or when prompted.

If I provide a known group name, the worker group is returned.

Get-AzAutomationHybridWorkerGroup -ResourceGroupName MYRESOURCEGROUP -AutomationAccountName MYAUTOMATIONACCOUNT
Get-AzAutomationHybridWorkerGroup -ResourceGroupName MYRESOURCEGROUP -AutomationAccountName MYAUTOMATIONACCOUNT -Name "HybridGroup"

ResourceGroupName : MYRESOURCEGROUP
AutomationAccountName : MYAUTOMATIONACCOUNT
Name : HybridGroup
RunbookWorker : {}
GroupType : User

NOTE: same behavior in 7.2 and 5.1
Name Value
---- -----
PSVersion 7.2.5
PSEdition Core
GitCommitId 7.2.5
OS Microsoft Windows 10.0.19044
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

### Issue script & Debug output

```PowerShell
DEBUG: 5:15:41 PM - GetAzureAutomationHybridWorkerGroup begin processing with ParameterSet 'ByAll'.
DEBUG: 5:15:41 PM - using account id 'XXXXX'...
DEBUG: 5:15:41 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: [Common.Authentication]: Authenticating using Account: 'XXXXX', environment: 'AzureCloud', tenant: 'XXXXX'
DEBUG: 5:15:41 PM - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'XXXXX', Scopes:'https://management.core.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/',
UserId:'XXXXX'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.38 - 3ed9c5e4-7222-4d9b-9606-d6821170ee24] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.38 - 3ed9c5e4-7222-4d9b-9606-d6821170ee24] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.38 - 3ed9c5e4-7222-4d9b-9606-d6821170ee24] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.38 - 3ed9c5e4-7222-4d9b-9606-d6821170ee24] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.38 - 3ed9c5e4-7222-4d9b-9606-d6821170ee24] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.38] Found 1 cache accounts and 0 broker accounts
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.38] Returning 1 accounts
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.38 - efd51847-3162-44c7-a245-e88ea7a400ad] MSAL MSAL.Desktop with assembly version '4.39.0.0'. CorrelationId(efd51847-3162-44c7-a245-e88ea7a400ad)
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.38 - efd51847-3162-44c7-a245-e88ea7a400ad] === AcquireTokenSilent Parameters ===
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.38 - efd51847-3162-44c7-a245-e88ea7a400ad] LoginHint provided: False
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.38 - efd51847-3162-44c7-a245-e88ea7a400ad] Account provided: True
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.38 - efd51847-3162-44c7-a245-e88ea7a400ad] ForceRefresh: False
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.38 - efd51847-3162-44c7-a245-e88ea7a400ad]
=== Request Data ===
Authority Provided? - True
Scopes - https://management.core.windows.net//.default
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenSilent
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - efd51847-3162-44c7-a245-e88ea7a400ad
UserAssertion set: False
LongRunningOboCacheKey set: False
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.38 - efd51847-3162-44c7-a245-e88ea7a400ad] === Token Acquisition (SilentRequest) started:
Scopes: https://management.core.windows.net//.default
Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.39 - efd51847-3162-44c7-a245-e88ea7a400ad] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.39 - efd51847-3162-44c7-a245-e88ea7a400ad] Access token is not expired. Returning the found cache entry. [Current time (08/11/2022 22:15:41) - Expiration Time (08/11/2022 22:44:31
+00:00) - Extended Expiration Time (08/11/2022 22:44:31 +00:00)]
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.39 - efd51847-3162-44c7-a245-e88ea7a400ad] Returning access token found in cache. RefreshOn exists ? False
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.39 - efd51847-3162-44c7-a245-e88ea7a400ad] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.39 - efd51847-3162-44c7-a245-e88ea7a400ad] Fetched access token from host login.microsoftonline.com.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.39 - efd51847-3162-44c7-a245-e88ea7a400ad]
=== Token Acquisition finished successfully:
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08/11 22:15:41.39 - efd51847-3162-44c7-a245-e88ea7a400ad] AT expiration time: 8/11/2022 10:44:31 PM +00:00, scopes https://management.core.windows.net//user_impersonation
https://management.core.windows.net//.default source Cache from login.microsoftonline.com appHashCode 15517263
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId: ExpiresOn: 2022-08-11T22:44:31.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: 'XXXXX', UserId: 'XXXXX'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/XXXXX/resourceGroups/XXXXX/providers/Microsoft.Automation/automationAccounts/XXXXX/hybridRunbookWorkerGroups?api-version=2020-01-13-preview

Headers:
x-ms-client-request-id : f00d1072-0fa8-444c-8f94-dcfbcb9341ea
accept-language : en-US

Body:

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Pragma : no-cache
x-ms-request-id : f00d1072-0fa8-444c-8f94-dcfbcb9341ea
x-ms-ratelimit-remaining-subscription-reads: 11999
x-ms-correlation-request-id : 62cd36b3-d878-44a3-9d4e-39e6898f92ec
x-ms-routing-request-id : NORTHCENTRALUS:20220811T221544Z:62cd36b3-d878-44a3-9d4e-39e6898f92ec
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Cache-Control : no-cache
Date : Thu, 11 Aug 2022 22:15:43 GMT
Server : Microsoft-HTTPAPI/2.0

Body:
{
"value": []
}

DEBUG: 5:15:41 PM - [ConfigManager] Got [True] from [EnableDataCollection], Module = [], Cmdlet = [].
DEBUG: AzureQoSEvent: Module: Az.Automation:1.7.3; CommandName: Get-AzAutomationHybridWorkerGroup; PSVersion: 5.1.19041.1682; IsSuccess: True; Duration: 00:00:00.3142217
DEBUG: Finish sending metric.
DEBUG: 5:15:41 PM - GetAzureAutomationHybridWorkerGroup end processing.
P
```

### Environment data

```PowerShell
Name Value
---- -----
PSVersion 5.1.19041.1682
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.1682
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```

### Module versions

```PowerShell
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 2.9.1 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault...}
Script 0.4.1 Az.AlertsManagement {Get-AzAlert, Get-AzAlertObjectHistory, Get-AzAlertProcessingRule, Get-AzSmartGroup...}
Script 1.7.3 Az.Automation {Export-AzAutomationDscConfiguration, Export-AzAutomationDscNodeReportContent, Export-AzAutomationRunbook, Get-AzAutomationAccount...}
Script 3.0.1 Az.Monitor {Add-AzAutoscaleSetting, Add-AzLogProfile, Add-AzMetricAlertRule, Add-AzMetricAlertRuleV2...}
Script 6.1.0 Az.Resources {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment...}
```

### Error output

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing Get-AzAutomationHybridWorkerGroup with and without -Name against the ARM hybridRunbookWorkerGroups endpoint shown in the debug output. Inspect the Az.Automation implementation for the ByAll parameter set and its handling of the successful empty response. Done means the no-name command returns existing worker groups while the named query continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, powershell
Domain
cli, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.