-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConnecting.ps1
More file actions
50 lines (38 loc) · 1.38 KB
/
Copy pathConnecting.ps1
File metadata and controls
50 lines (38 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<#
.SYNOPSIS
Connect to Confluence and manage credential profiles (contexts).
.DESCRIPTION
Confluence stores each connection as a named context in the Context vault.
The token is kept as a SecureString. One context is the default; any command
can target a specific context with -Context.
#>
# Import the module
Import-Module -Name 'Confluence'
###
### CONNECTING
###
# Connect with a scoped Atlassian API token and store a reusable default profile.
# -Site takes a subdomain, host, or any URL on the site and resolves the cloud ID for you.
$token = Read-Host -AsSecureString # a scoped Atlassian API token
Connect-Confluence -Site 'yoursite' -Username 'you@example.com' -Token $token -SpaceKey 'DOCS'
# Store several sites/accounts under explicit names and select per call.
# If you already know the cloud ID, pass it directly with -CloudId to skip the lookup.
Connect-Confluence -CloudId '<cloudId>' -Username 'you@example.com' -Token $token -Name 'sandbox'
Get-ConfluenceSpace -Key 'DOCS' -Context 'sandbox'
###
### CONTEXTS / PROFILES
###
# The default context
Get-ConfluenceContext
# All stored contexts
Get-ConfluenceContext -ListAvailable
###
### MODULE CONFIGURATION
###
# Read and set module configuration (persisted in the same vault).
Get-ConfluenceConfig
Set-ConfluenceConfig -Name 'PerPage' -Value 50
###
### DISCONNECTING
###
Disconnect-Confluence -Name 'sandbox'