Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export-AzAutomationRunbook does not export runbooks with underscore #20731

Closed
nielsvdc opened this issue Jan 23, 2023 · 8 comments
Closed

Export-AzAutomationRunbook does not export runbooks with underscore #20731

nielsvdc opened this issue Jan 23, 2023 · 8 comments
Labels
Automation bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Service Attention This issue is responsible by Azure service team.

Comments

@nielsvdc
Copy link

Description

When using the cmdlet Export-AzAutomationRunbook to export runbooks with an underscore in the name, I get the error "Export-AzAutomationRunbook : 'runbookName' does not match expected pattern '^[a-zA-Z]-[a-zA-Z0-9]*$'.".

This is an invalid message, because runbooks are allowed to have underscore characters in their name. I'm now unable to use PowerShell to bulk export all my runbooks.

Issue script & Debug output

$DebugPreference='Continue'
Export-AzAutomationRunbook "AAD_AddUserToGroup" -AutomationAccountName $AutomationAccountName -ResourceGroupName $ResourceGroupName
DEBUG: 15:13:02 - ExportAzureAutomationRunbook begin processing with ParameterSet 'ByRunbookName'.
DEBUG: 15:13:02 - using account id '[email protected]'...
DEBUG: 15:13:02 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: [Common.Authentication]: Authenticating using Account: '[email protected]', environment: 'AzureCloud', tenant: '00000000-0000-0000-0000-000000000000'
DEBUG: 15:13:02 - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'00000000-0000-0000-0000-000000000000', Scopes:'https://management.cor
e.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/', UserId:'[email protected]'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId: 
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - cd3bc71c-4da1-4f02-8de0-40c5f102b11e] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - cd3bc71c-4da1-4f02-8de0-40c5f102b11e] [Region discovery] Not using a regional 
authority. 
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - cd3bc71c-4da1-4f02-8de0-40c5f102b11e] [Region discovery] Not using a regional 
authority. 
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - cd3bc71c-4da1-4f02-8de0-40c5f102b11e] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - cd3bc71c-4da1-4f02-8de0-40c5f102b11e] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z] [WamBroker] WAM supported OS.
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z] [WamBroker] ListWindowsWorkAndSchoolAccounts option was not enabled.
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 178514e0-b608-4d1e-864d-252c8419dab2] [Region discovery] Not using a regional 
authority. 
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z] Found 1 cache accounts and 0 broker accounts
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z] Returning 1 accounts
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] MSAL MSAL.Desktop with assembly version 
'4.49.1.0'. CorrelationId(4d7437ad-0643-4ec9-bd4e-cb351d19115d)
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] === AcquireTokenSilent Parameters ===
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] LoginHint provided: False
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] Account provided: True
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] ForceRefresh: False
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] 
=== 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 - True
HomeAccountId - False
CorrelationId - 4d7437ad-0643-4ec9-bd4e-cb351d19115d
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured: 

DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] === Token Acquisition (SilentRequest) st
arted:
	 Scopes: https://management.core.windows.net//.default
	Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] [Region discovery] Not using a regional 
authority. 
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] Access token is not expired. Returning t
he found cache entry. [Current time (01/23/2023 14:13:02) - Expiration Time (01/23/2023 14:28:34 +00:00) - Extended Expiration Time (01/23/2023 14:28:34 +00:00)]
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] Returning access token found in cache. R
efreshOn exists ? False
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] [Region discovery] Not using a regional 
authority. 
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] 
	=== Token Acquisition finished successfully:
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d]  AT expiration time: 23-1-2023 14:28:34 
+00:00, scopes: https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default. source: Cache
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:  ExpiresOn: 2023-01-23T14:28:34.0000000+0
0:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: '00000000-0000-0000-0000-000000000000', UserId: '[email protected]'
DEBUG: 15:13:02 - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
Export-AzAutomationRunbook : 'runbookName' does not match expected pattern '^[a-zA-Z]*-*[a-zA-Z0-9]*$'.
At line:3 char:1
+ Export-AzAutomationRunbook "AAD_AddUserToGroup" -AutomationAccountNam ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Export-AzAutomationRunbook], ValidationException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Automation.Cmdlet.ExportAzureAutomationRunbook
 
DEBUG: 15:13:02 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Automation:1.9.0; CommandName: Export-AzAutomationRunbook; PSVersion: 5.1.22621.963; IsSuccess: False; Duration: 00:00:00.0404164; Excep
tion: 'runbookName' does not match expected pattern '^[a-zA-Z]*-*[a-zA-Z0-9]*$'.;
DEBUG: 15:13:02 - ExportAzureAutomationRunbook end processing.

Environment data

$PSVersionTable

Name                           Value                                                                                                                                     
----                           -----                                                                                                                                     
PSVersion                      5.1.22621.963                                                                                                                             
PSEdition                      Desktop                                                                                                                                   
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                   
BuildVersion                   10.0.22621.963                                                                                                                            
CLRVersion                     4.0.30319.42000                                                                                                                           
WSManStackVersion              3.0                                                                                                                                       
PSRemotingProtocolVersion      2.3                                                                                                                                       
SerializationVersion           1.1.0.1

Module versions

Get-Module Az*

ModuleType Version    Name                                ExportedCommands                                                                                               
---------- -------    ----                                ----------------                                                                                               
Script     2.11.1     Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault...}                                       
Script     1.9.0      Az.Automation                       {Export-AzAutomationDscConfiguration, Export-AzAutomationDscNodeReportContent, Export-AzAutomationRunbook, G...

Error output

Resolve-AzError
DEBUG: 15:16:52 - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 15:16:52 - using account id '[email protected]'...
DEBUG: 15:16:52 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' :
The `Resolve-Error` alias will be removed in a future release.  Please change any scripts that use this alias to use `Resolve-AzError` instead.
Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.


   HistoryId: 30


Message        : 'runbookName' does not match expected pattern '^[a-zA-Z]*-*[a-zA-Z0-9]*$'.
StackTrace     :    at Microsoft.Azure.Management.Automation.RunbookOperations.<GetWithHttpMessagesAsync>d__7.MoveNext()
                 --- End of stack trace from previous location where exception was thrown ---
                    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                    at Microsoft.Azure.Management.Automation.RunbookOperationsExtensions.<GetAsync>d__5.MoveNext()
                 --- End of stack trace from previous location where exception was thrown ---
                    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                    at Microsoft.Azure.Management.Automation.RunbookOperationsExtensions.Get(IRunbookOperations operations, String resourceGroupName, String automationAc
                 countName, String runbookName)
                    at Microsoft.Azure.Commands.Automation.Common.AutomationPSClient.TryGetRunbookModel(String resourceGroupName, String automationAccountName, String ru
                 nbookName)
                    at Microsoft.Azure.Commands.Automation.Common.AutomationPSClient.ExportRunbook(String resourceGroupName, String automationAccountName, String runbook
                 Name, Nullable`1 isDraft, String outputFolder, Boolean overwrite)
                    at Microsoft.Azure.Commands.Automation.Cmdlet.ExportAzureAutomationRunbook.AutomationProcessRecord()
                    at Microsoft.Azure.Commands.Automation.Cmdlet.AzureAutomationBaseCmdlet.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : Microsoft.Rest.ValidationException
InvocationInfo : {Export-AzAutomationRunbook}
Line           : Export-AzAutomationRunbook "AAD_AddUserToGroup" -AutomationAccountName $AutomationAccountName -ResourceGroupName $ResourceGroupName
Position       : At line:3 char:1
                 + Export-AzAutomationRunbook "AAD_AddUserToGroup" -AutomationAccountNam ...
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 30
@nielsvdc nielsvdc added bug This issue requires a change to an existing behavior in the product in order to be resolved. needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Jan 23, 2023
@ghost ghost added customer-reported CXP Attention [Deprecated] The Azure CXP Support Team is responsible for this issue. and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Jan 23, 2023
@ghost
Copy link

ghost commented Jan 23, 2023

Thank you for your feedback. This has been routed to the support team for assistance.

@RakeshMohanMSFT RakeshMohanMSFT self-assigned this Jan 23, 2023
@RakeshMohanMSFT
Copy link
Contributor

@nielsvdc Thank you for reaching out, we are looking into it.

@RakeshMohanMSFT
Copy link
Contributor

@nielsvdc To unblock yourself, see if you can downgrade the Az.Automation module to 1.8.0 and retry the operation.
We are looking into the actual issue.

@RakeshMohanMSFT RakeshMohanMSFT added Service Attention This issue is responsible by Azure service team. and removed CXP Attention [Deprecated] The Azure CXP Support Team is responsible for this issue. labels Jan 30, 2023
@ghost
Copy link

ghost commented Jan 30, 2023

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jaspkaur28, @.

Issue Details

Description

When using the cmdlet Export-AzAutomationRunbook to export runbooks with an underscore in the name, I get the error "Export-AzAutomationRunbook : 'runbookName' does not match expected pattern '^[a-zA-Z]-[a-zA-Z0-9]*$'.".

This is an invalid message, because runbooks are allowed to have underscore characters in their name. I'm now unable to use PowerShell to bulk export all my runbooks.

Issue script & Debug output

$DebugPreference='Continue'
Export-AzAutomationRunbook "AAD_AddUserToGroup" -AutomationAccountName $AutomationAccountName -ResourceGroupName $ResourceGroupName
DEBUG: 15:13:02 - ExportAzureAutomationRunbook begin processing with ParameterSet 'ByRunbookName'.
DEBUG: 15:13:02 - using account id '[email protected]'...
DEBUG: 15:13:02 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: [Common.Authentication]: Authenticating using Account: '[email protected]', environment: 'AzureCloud', tenant: '00000000-0000-0000-0000-000000000000'
DEBUG: 15:13:02 - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'00000000-0000-0000-0000-000000000000', Scopes:'https://management.cor
e.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/', UserId:'[email protected]'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId: 
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - cd3bc71c-4da1-4f02-8de0-40c5f102b11e] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - cd3bc71c-4da1-4f02-8de0-40c5f102b11e] [Region discovery] Not using a regional 
authority. 
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - cd3bc71c-4da1-4f02-8de0-40c5f102b11e] [Region discovery] Not using a regional 
authority. 
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - cd3bc71c-4da1-4f02-8de0-40c5f102b11e] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - cd3bc71c-4da1-4f02-8de0-40c5f102b11e] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z] [WamBroker] WAM supported OS.
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z] [WamBroker] ListWindowsWorkAndSchoolAccounts option was not enabled.
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 178514e0-b608-4d1e-864d-252c8419dab2] [Region discovery] Not using a regional 
authority. 
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z] Found 1 cache accounts and 0 broker accounts
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z] Returning 1 accounts
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] MSAL MSAL.Desktop with assembly version 
'4.49.1.0'. CorrelationId(4d7437ad-0643-4ec9-bd4e-cb351d19115d)
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] === AcquireTokenSilent Parameters ===
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] LoginHint provided: False
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] Account provided: True
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] ForceRefresh: False
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] 
=== 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 - True
HomeAccountId - False
CorrelationId - 4d7437ad-0643-4ec9-bd4e-cb351d19115d
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured: 

DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] === Token Acquisition (SilentRequest) st
arted:
	 Scopes: https://management.core.windows.net//.default
	Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] [Region discovery] Not using a regional 
authority. 
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] Access token is not expired. Returning t
he found cache entry. [Current time (01/23/2023 14:13:02) - Expiration Time (01/23/2023 14:28:34 +00:00) - Extended Expiration Time (01/23/2023 14:28:34 +00:00)]
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] Returning access token found in cache. R
efreshOn exists ? False
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] [Region discovery] Not using a regional 
authority. 
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d] 
	=== Token Acquisition finished successfully:
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows 10 Pro [2023-01-23 14:13:02Z - 4d7437ad-0643-4ec9-bd4e-cb351d19115d]  AT expiration time: 23-1-2023 14:28:34 
+00:00, scopes: https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default. source: Cache
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:  ExpiresOn: 2023-01-23T14:28:34.0000000+0
0:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: '00000000-0000-0000-0000-000000000000', UserId: '[email protected]'
DEBUG: 15:13:02 - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
Export-AzAutomationRunbook : 'runbookName' does not match expected pattern '^[a-zA-Z]*-*[a-zA-Z0-9]*$'.
At line:3 char:1
+ Export-AzAutomationRunbook "AAD_AddUserToGroup" -AutomationAccountNam ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Export-AzAutomationRunbook], ValidationException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Automation.Cmdlet.ExportAzureAutomationRunbook
 
DEBUG: 15:13:02 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Automation:1.9.0; CommandName: Export-AzAutomationRunbook; PSVersion: 5.1.22621.963; IsSuccess: False; Duration: 00:00:00.0404164; Excep
tion: 'runbookName' does not match expected pattern '^[a-zA-Z]*-*[a-zA-Z0-9]*$'.;
DEBUG: 15:13:02 - ExportAzureAutomationRunbook end processing.

Environment data

$PSVersionTable

Name                           Value                                                                                                                                     
----                           -----                                                                                                                                     
PSVersion                      5.1.22621.963                                                                                                                             
PSEdition                      Desktop                                                                                                                                   
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                   
BuildVersion                   10.0.22621.963                                                                                                                            
CLRVersion                     4.0.30319.42000                                                                                                                           
WSManStackVersion              3.0                                                                                                                                       
PSRemotingProtocolVersion      2.3                                                                                                                                       
SerializationVersion           1.1.0.1

Module versions

Get-Module Az*

ModuleType Version    Name                                ExportedCommands                                                                                               
---------- -------    ----                                ----------------                                                                                               
Script     2.11.1     Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault...}                                       
Script     1.9.0      Az.Automation                       {Export-AzAutomationDscConfiguration, Export-AzAutomationDscNodeReportContent, Export-AzAutomationRunbook, G...

Error output

Resolve-AzError
DEBUG: 15:16:52 - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 15:16:52 - using account id '[email protected]'...
DEBUG: 15:16:52 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' :
The `Resolve-Error` alias will be removed in a future release.  Please change any scripts that use this alias to use `Resolve-AzError` instead.
Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.


   HistoryId: 30


Message        : 'runbookName' does not match expected pattern '^[a-zA-Z]*-*[a-zA-Z0-9]*$'.
StackTrace     :    at Microsoft.Azure.Management.Automation.RunbookOperations.<GetWithHttpMessagesAsync>d__7.MoveNext()
                 --- End of stack trace from previous location where exception was thrown ---
                    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                    at Microsoft.Azure.Management.Automation.RunbookOperationsExtensions.<GetAsync>d__5.MoveNext()
                 --- End of stack trace from previous location where exception was thrown ---
                    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                    at Microsoft.Azure.Management.Automation.RunbookOperationsExtensions.Get(IRunbookOperations operations, String resourceGroupName, String automationAc
                 countName, String runbookName)
                    at Microsoft.Azure.Commands.Automation.Common.AutomationPSClient.TryGetRunbookModel(String resourceGroupName, String automationAccountName, String ru
                 nbookName)
                    at Microsoft.Azure.Commands.Automation.Common.AutomationPSClient.ExportRunbook(String resourceGroupName, String automationAccountName, String runbook
                 Name, Nullable`1 isDraft, String outputFolder, Boolean overwrite)
                    at Microsoft.Azure.Commands.Automation.Cmdlet.ExportAzureAutomationRunbook.AutomationProcessRecord()
                    at Microsoft.Azure.Commands.Automation.Cmdlet.AzureAutomationBaseCmdlet.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : Microsoft.Rest.ValidationException
InvocationInfo : {Export-AzAutomationRunbook}
Line           : Export-AzAutomationRunbook "AAD_AddUserToGroup" -AutomationAccountName $AutomationAccountName -ResourceGroupName $ResourceGroupName
Position       : At line:3 char:1
                 + Export-AzAutomationRunbook "AAD_AddUserToGroup" -AutomationAccountNam ...
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 30
Author: nielsvdc
Assignees: RakeshMohanMSFT
Labels:

Automation, Service Attention, bug, customer-reported

Milestone: -

@RakeshMohanMSFT RakeshMohanMSFT removed their assignment Jan 30, 2023
@SnhuSpooner
Copy link

I am running into the same failure with Start-AzAutomationRunbook when the runbook name has underscores in it. I opened a support ticket which confirmed that the issue was introduced in version 1.9.0.

Microsoft should make a broad announcement to the Azure community, rollback version 1.9.0 to the prior version to unblock its customers, and re-release that version after adequate testing.

@jaspkaur28
Copy link

@SnhuSpooner @nielsvdc The issue has been fixed by the PG . Fix was rolled out on 02/13. Can you please confirm if the cmdlets are working now ?

@nielsvdc
Copy link
Author

@jaspkaur28 Looks good to me. Thanks MSFT team!

@SnhuSpooner
Copy link

I use Microsoft-hosted images in our Azure DevOps pipeline, so the issue doesn't appear fixed there yet until the team that manages those images accepts the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Automation bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

4 participants