You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I am trying to connect to my company's confluence space by using the ConfluencePS but I cannot seem to authenticate my account.
I have created an PAT on both Atlassian.net and directly on the Data Center that Confluence is hosted on. Neither seem to work.
The URI is set up in the format "https://confl.CompanyName.com".
The code I am using to attempt to connect is shown below.
Import-Module ConfluencePS
$Username = 'first.last@mycompany.com'
$Password = 'full_token_string' | ConvertTo-SecureString -AsPlainText -Force
$Credentials = New-Object System.Management.Automation.PsCredential($Username,$Password)
Set-ConfluenceInfo -BaseURI 'https://confl.CompanyName.com' -Credential $Credentials
Get-ConfluenceSpace -SpaceKey '####'
When this runs, I receive back a 401: UNAUTHORIZED error
I've also tried for the password, the token name, the Atlassian token, the password to my account, the token on the data center. I can't seem to find what is expecting.
Can ConfluencePS work on Data Center based Confluence pages? How can I go about using this?
@Brendan ,
You can try first if Authentication works using other method like CURL or HTTPIE or Postman, etc. just to be sure that the user/password and the encoded password work. For authentication you can use headers as { "Authentication": "Basic {base64encodedPassword}"}.
Powershell simple GET to check auth:
$cred = Get-Credential
Invoke-WebRequest -Uri 'https://confl.CompanyName.com/rest/api/content' -Credential $cred
Invoke-WebRequest -Method Get -Uri 'https://confl.CompanyName.com/rest/api/content' -Authentication Basic
other clis:
https -a user:pass https://confl.CompanyName.com/rest/api/content
curl -X user:pass https://confl.CompanyName.com/rest/api/content
https -a user:pass https://confl.CompanyName.com/rest/api/content
Thanks for the answer, it seems like I am able to reach the API when using the Invoke-WebRequest or curl methods but when I try to do anything with the ConfluencePS module, I still am seeing the 401 error. Image attached for reference.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Brendan ,
It needs more deep debugging of what is the cause in code. Maybe it would be better to contact the team of ConfuencePS:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for all the help. I have posted within there. If I find an answer I will be sure to post it here.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.