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.
Some thoughts.
If this 'additional work' is being done for the same product, then may be a new project for that customer is unnecessary, it could be a new version for the same.
And to group the projects across customers, you could use Categories.
And if the same product is being done for multiple customers, then it does not make sense to use categories. Since customfields/components is issue specific, you need to repeat in each of them. At a project level if you need to specify which customer uses which versions, a wiki page would be the best and the url of which could be put in the project properties.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.