Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to attach files to Jira Ticket via PowerShell Edited


The following curl command attaches a file to Jira ticket without a problem:

curl -D- -u jira:password -X POST -H "X-Atlassian-Token: no-check" -F "file=@myfile.txt"


However, trying to perform the same task using PowerShell always fails:

Invoke-RestMethod -Headers $jira_headers -Uri $uri -Method POST -InFile $myfile


Tried all possible header options including:
"Authorization" = $basicAuth   <--- this is not a problem (works otherwise)
'X-Atlassian-Token' = 'nocheck'
'Content-Type' = 'multipart/form-data'

and also using

[Net.ServicePointManager]::SecurityProtocol = ([Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12)


All other features via PowerShell work (download files, update Jira ticket), but for some reason File upload will not work (using PowerShell 5.1).


Any ideas would be highly appreciated.

Best regards,


1 answer

1 accepted

0 votes
Answer accepted

Managed to figure it out based on Jira module and the following stackoverflow article:


$jira_headers = @{
                              "Authorization" = $basicAuth
                              "X-Atlassian-Token" = "nocheck" <--- Does NOT work without this line



$uri = ""
$myfile = "C:\Users\myuser\Desktop\testing.txt"


$fileBytes = [System.IO.File]::ReadAllBytes($myfile);
$fileEnc = [System.Text.Encoding]::GetEncoding('UTF-8').GetString($fileBytes);
$boundary = [guid]::NewGuid().ToString()
$LF = "`r`n";


$body = (
                "Content-Disposition: form-data; name=`"file`"; filename=`"testing.txt`"",
                "Content-Type: application/octet-stream$LF",
               ) -join $LF


Invoke-RestMethod -Headers $jira_headers -Uri $uri -Method POST -ContentType "multipart/form-data; boundary=`"$boundary`"" -Body $body

Im trying to upload image/jpg or image/png do you know how i can do that?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Management

JSM June ask me anything (AMA)

Hello Community members! We’re wrapping up the end of JSM June with an Ask Me Anything (AMA) with the Jira Service Management product team. This is your chance to ask all your ITSM questions to o...

147 views 9 10
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you