Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

using powershell to Grant permission to bamboo project to User using REST API

Hi Team , 

We are trying to  implement to grant project permission to the user using powershell , and we are stuck in how to pass this values  "[ \"READ\", \"CREATE\",\"ADMINISTRATION\"]" to a rest api 

this below is the powershell syntax

$jParams = @{
Uri = (<bambooURL>, rest/api/latest/permissions/project/ -join "/") + "<ProjectName>" + "/users/" + "userID"
Method = 'PUT'
Headers = $jHeaders
}

How to pass this values "[ \"READ\", \"CREATE\",\"ADMINISTRATION\"]" to below command

try {
$bambooProjectAdminAddDataResponse = Invoke-RestMethod @jParams -ErrorAction Stop
}

 

Please assist us if anyone has suggestion how to achieve this 

1 answer

1 accepted

0 votes
Answer accepted
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 26, 2022 • edited

Hello @krishnateja ,

Please try the following:

$userID = '<username>'
$password = '<password>'
$credPair = "$($userID):$($password)"
$ProjectName = "<ProjectKey>"
$BambooURL = "https://bamboo.mydomain.net"

$encodedCredentials = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($credPair))

$Body = @( "READ", "CREATE", "ADMINISTRATION" )

$JsonBody = $Body | ConvertTo-Json

$Params = @{
Method = "Put"
  Headers = @{ 'Authorization' = "Basic $encodedCredentials" }
  Uri = -join($BambooURL + "/rest/api/latest/permissions/project/" + $ProjectName + "/users/" + $userID)
  Body = $JsonBody
  ContentType = "application/json"
}

Invoke-RestMethod @Params

You can find more information about Bamboo REST API on this page:

Best regards,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

Thanks Eduardo Alvarenga ,

The solution helped us a lot. .!

Like Eduardo Alvarenga likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events