azure-powershell
azure-powershell copied to clipboard
Start-AzureRMAutomationRunbook -RunOn Poor Error Message When HW does not exist
Cmdlet(s)
Start-AzureRMAutomationRunbook
PowerShell Version
5.1.15.06.168
Module Version
2.8
OS Version
10.0.15063.168
Description
if you use a value that is not resolved as a hybrid worker for the RunOn Parameter the error message provided leads you to think there is a problem with finding the automation account when that is not the case.
Please update the exception message that is thrown to be a meaningful error message
Debug Output
DEBUG: 3:17:44 PM - using account id ''...
DEBUG: [Common.Authentication]: Authenticating using Account: '', environment: 'AzureCloud', tenant:
'25247498-ad2d-XXXX-XXXX-XXXXXXXX'
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/27/2017 20:17:44: - TokenCache: Deserialized 4 items to token cache.
DEBUG: [Common.Authentication]: Authenticating using configuration values: Domain:
'25247498-ad2d-45d3-XXXX-XXXXXXXX', Endpoint: 'https://login.microsoftonline.com/', ClientId:
'1950a258-227b-XXXX-XXXXXXXXX', ClientRedirect: 'urn:ietf:wg:oauth:2.0:oob', ResourceClientUri:
'https://management.core.windows.net/', ValidateAuthrity: 'True'
DEBUG: [Common.Authentication]: Acquiring token using context with Authority
'https://login.microsoftonline.com/25247498-ad2d-45d3-XXXXX-XXXXXX/', CorrelationId:
'00000000-0000-0000-0000-000000000000', ValidateAuthority: 'True'
DEBUG: [Common.Authentication]: Acquiring token using AdalConfiguration with Domain:
'25247498-ad2d-45d3-bdf3-XXXXXX, AdEndpoint: 'https://login.microsoftonline.com/', ClientId:
'1950a258-227b-4e31-a9cf-XXXXXXXX', ClientRedirectUri: urn:ietf:wg:oauth:2.0:oob
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/27/2017 20:17:44: 1404ed4c-c009-4bee-ac57-XXXXXX - AcquireTokenHandlerBase: === Token Acquisition
started:
Authority: https://login.microsoftonline.com/25247498-ad2d-45d3-XXXX-XXXXXX/
Resource: https://management.core.windows.net/
ClientId: 1950a258-227b-4e31-a9cf-XXXXXX
CacheType: Microsoft.IdentityModel.Clients.ActiveDirectory.TokenCache (4 items)
Authentication Target: User
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 04/27/2017 20:17:44: 1404ed4c-c009-4bee-ac57-XXXXXXXXX - TokenCache: Looking up cache for a token...
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/27/2017 20:17:44: 1404ed4c-c009-4bee-ac57-XXXXXXXX - TokenCache: An item matching the requested resource
was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 04/27/2017 20:17:44: 1404ed4c-c009-4bee-ac57-XXXXXXXX - TokenCache: 38.1313946283333 minutes left until
token in cache expires
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/27/2017 20:17:44: 1404ed4c-c009-4bee-ac57-XXXXXXXXX - TokenCache: A matching item (access token or refresh
token or both) was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/27/2017 20:17:44: 1404ed4c-c009-4bee-ac57-XXXXXXX - AcquireTokenHandlerBase: === Token Acquisition
finished successfully. An access token was retuned:
Access Token Hash:
Refresh Token Hash:
Expiration Time: 04/27/2017 20:55:52 +00:00
User Hash:
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/27/2017 20:17:44: - TokenCache: Serializing token cache with 4 items.
DEBUG: [Common.Authentication]: Received token with LoginType 'LiveId', Tenant: '25247498-ad2d-45d3-XXXX-XXXXXXX,
UserId: ''
DEBUG: [Common.Authentication]: Renewing Token with Type: 'Bearer', Expiry: '04/27/2017 20:55:52 +00:00',
MultipleResource? 'True', Tenant: '25247498-ad2d-45d3-XXXX-XXXXX', UserId: ''
DEBUG: [Common.Authentication]: User info for token DisplayId: '', Name: Rob Plank, IdProvider:
'live.com', Uid: 'bf0911a7-3589-4c10-XXXX-XXXXXX'
DEBUG: [Common.Authentication]: Checking token expiration, token expires '04/27/2017 20:55:52 +00:00' Comparing to
'04/27/2017 20:17:44 +00:00' With threshold '00:05:00', calculated time until token expiry: '00:38:07.8826767'
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/subscriptions/e053beae-9598-4251-a048-XXXXXXX/resourceGroups/mms-eus/providers/Micros
oft.Automation/automationAccounts/MSDNAutomation/runbooks/Test-OMSLogging?api-version=2015-10-31
Headers:
Accept : application/json
x-ms-version : 2014-06-01
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Pragma : no-cache
x-ms-request-id : a1425f85-5349-4b88-a7df-19c092e89979
Strict-Transport-Security : max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-reads: 14997
x-ms-correlation-request-id : fc48adce-78e0-4cf7-b137-c0264bbb1aea
x-ms-routing-request-id : CENTRALUS:20170427T201745Z:fc48adce-78e0-4cf7-b137-c0264bbb1aea
Cache-Control : no-cache
Date : Thu, 27 Apr 2017 20:17:44 GMT
ETag : "636209675854200000"
Server : Microsoft-IIS/8.5
X-AspNet-Version : 4.0.30319
X-Powered-By : ASP.NET
Body:
{
"id":
"/subscriptions/e053beae-9598-4251-XX-XXXXXXXXXXXX/resourceGroups/mms-eus/providers/Microsoft.Automation/automationAc
counts/MSDNAutomation/runbooks/Test-OMSLogging",
"name": "Test-OMSLogging",
"type": "Microsoft.Automation/AutomationAccounts/Runbooks",
"location": "East US 2",
"tags": {},
"etag": "\"636209675854200000\"",
"properties": {
"description": null,
"logVerbose": false,
"logProgress": false,
"logActivityTrace": 0,
"runbookType": "PowerShell",
"parameters": {},
"state": "Published",
"jobCount": 4,
"provisioningState": "Succeeded",
"serviceManagementTags": null,
"outputTypes": [],
"creationTime": "2017-01-25T12:59:36.657-06:00",
"lastModifiedBy": "",
"lastModifiedTime": "2017-01-25T12:59:45.42-06:00"
}
}
DEBUG: [Common.Authentication]: Renewing Token with Type: 'Bearer', Expiry: '04/27/2017 20:55:52 +00:00',
MultipleResource? 'True', Tenant: '25247498-ad2d-45d3-XXXXX-XXXX', UserId: ''
DEBUG: [Common.Authentication]: User info for token DisplayId: '', Name: Rob Plank, IdProvider:
'live.com', Uid: 'bf0911a7-3589-4c10-XXX'
DEBUG: [Common.Authentication]: Checking token expiration, token expires '04/27/2017 20:55:52 +00:00' Comparing to
'04/27/2017 20:17:45 +00:00' With threshold '00:05:00', calculated time until token expiry: '00:38:07.5189040'
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
PUT
Absolute Uri:
https://management.azure.com/subscriptions/e053beae-9598-4251-XXXXXXX/resourceGroups/mms-eus/providers/Micros
oft.Automation/automationAccounts/MSDNAutomation/jobs/90da2b47-e920-464b-8d56-7981790315dd?api-version=2015-10-31
Headers:
Accept : application/json
x-ms-version : 2014-06-01
Body:
{
"properties": {
"runbook": {
"name": "Test-OMSLogging"
},
"parameters": {},
"runOn": "AAHW00"
},
"tags": {}
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
NotFound
Headers:
Pragma : no-cache
x-ms-request-id : a1425f85-5349-4b88-a7df-19c092e89979
Strict-Transport-Security : max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-writes: 1197
x-ms-correlation-request-id : c1b32b70-8bd5-4bea-8fc9-60334694155b
x-ms-routing-request-id : CENTRALUS:20170427T201745Z:c1b32b70-8bd5-4bea-8fc9-60334694155b
Cache-Control : no-cache
Date : Thu, 27 Apr 2017 20:17:45 GMT
Server : Microsoft-IIS/8.5
X-AspNet-Version : 4.0.30319
X-Powered-By : ASP.NET
Body:
{
"code": "NotFound",
"message": "The Hybrid Runbook Worker Group given in RunOn parameter does not exist."
}
Start-AzureRmAutomationRunbook : The Automation account was not found.
At line:1 char:1
+ Start-AzureRmAutomationRunbook -Name Test-OMSLogging -RunOn AAHW00 -R ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Start-AzureRmAutomationRunbook], ArgumentException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Automation.Cmdlet.StartAzureAutomationRunbook
DEBUG: 3:17:45 PM - StartAzureAutomationRunbook end processing.
DEBUG: 3:17:45 PM - StartAzureAutomationRunbook end processing.
Script/Steps for Reproduction
example of the error (the hybrid worker does not exist in my subscription)
ationAccountName MSDNAutomation
Start-AzureRmAutomationRunbook : The Automation account was not found.
At line:1 char:1
+ Start-AzureRmAutomationRunbook -Name Test-OMSLogging -RunOn AAHW00 -R ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Start-AzureRmAutomationRunbook], ArgumentException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Automation.Cmdlet.StartAzureAutomationRunbook
working example of starting a runbook on a hybrid worker
ationAccountName MSDNAutomation
ResourceGroupName : mms-eus
AutomationAccountName : MSDNAutomation
JobId : f92944d2-95fe-4c50-80b2-5830a0879ace
CreationTime : 4/27/2017 2:55:02 PM -05:00
Status : New
StatusDetails : None
StartTime :
EndTime :
Exception :
LastModifiedTime : 4/27/2017 2:55:02 PM -05:00
LastStatusModifiedTime : 4/27/2017 2:55:02 PM -05:00
JobParameters : {}
RunbookName : Test-OMSLogging
HybridWorker : AAHW01
StartedBy : <USERACCOUNTREMOVED>
+1 - Thanks for submitting!
@eamonoreilly @safeermohammed would you mind taking a look at this issue?
This has been fixed in a newer version.