Dear community,
I'm having trouble connecting to my companies Jira server using a powershell script and the Invoke-WebRequest commandlet.
I'm using the following script. Note that I'm getting the same error with any valid URI to this Jira server. While the same user can access all these URI's through a webbrowser just fine.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$baseUrl = "https://MyDomain.atlassian.net"
$jql = "%22Epic Link%22 = SD-2"
$user = 'USER@MyDomain.com'
$pass = 'TheCorrectPassword'
$pair = "$($user):$($pass)"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$basicAuthValue = "Basic $encodedCreds"
$authHeader = @{
Authorization = $basicAuthValue
}
Invoke-WebRequest -uri $($baseUrl + "/rest/api/latest/search?jql=$jql") -Headers $authHeader -UseBasicParsing -ErrorAction Stop -Verbose
Output from powershell:
Invoke-WebRequest : The remote server returned an error: (401) Unauthorized.
At D:\Work\JiraAccess2.ps1:22 char:1
+ Invoke-WebRequest -uri $($baseUrl + "/rest/api/latest/search?jql=$jql ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Could there be a setting on the Jira Server that prevents this user from connecting via "Invoke-WebRequest"? Or is something wrong with my script?
Edit: I'm using the cloud version.
JIRA Agile has a cross-version compatibility layer so that it can "bridge" a common internal abstraction of several services to the correct linkage in different versions, conditionally take advantage of services as they appear, and so on. The BridgeServiceLocator is the class that helps it figure out which version of a service to use, find it, and use it. It should be initialized automatically as part of JIRA Agile starting up, and when JIRA Agile goes away or gets upgraded, the old one is explicitly cleared out.
The error message you are seeing means one of two things has happened. Either:
BridgeServiceLocator for some reason was never initialized; or,BridgeServiceLocator successfully shut itself down, and those leftover bits are still trying to respond to issue events. In the course of doing so they are trying to talk to the bridge service, and since it's gone you get the error message you reported.Neither situation is a good one. I would recommend restarting to see if it clears the situation up, and you might consider reporting this in a support case along with your log files to see if the reason for the failure can be identified in them.
Thank you Chris,
I'm gonna raise this issue at Agile plugin staff.
Edit : Actually it got fixed by it-self by rebooting the server. Thanks again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.