< Back
Set-GitHubAuthentication
Post
NAME Set-GitHubAuthentication
SYNOPSIS
Allows the user to configure the API token that should be used for authentication
with the GitHub API.
SYNTAX
Set-GitHubAuthentication [[-Credential] <PSCredential>] [-SessionOnly] [-WhatIf] [-Confirm] [<CommonParameters>]
DESCRIPTION
Allows the user to configure the API token that should be used for authentication
with the GitHub API.
The token will be stored on the machine as a SecureString and will automatically
be read on future PowerShell sessions with this module. If the user ever wishes
to remove their authentication from the system, they simply need to call
Clear-GitHubAuthentication.
The Git repo for this module can be found here: http://aka.ms/PowerShellForGitHub
PARAMETERS
-Credential <PSCredential>
If provided, instead of prompting the user for their API Token, it will be extracted
from the password field of this credential object.
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-SessionOnly [<SwitchParameter>]
By default, this method will store the provided API Token as a SecureString in a local
file so that it can be restored automatically in future PowerShell sessions. If this
switch is provided, the file will not be created/updated and the authentication information
will only remain in memory for the duration of this PowerShell session.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Set-GitHubAuthentication
Prompts the user for their GitHub API Token and stores it in a file on the machine as a
SecureString for use in future PowerShell sessions.
-------------------------- EXAMPLE 2 --------------------------
$secureString = ("<Your Access Token>" | ConvertTo-SecureString)
$cred = New-Object System.Management.Automation.PSCredential "username is ignored", $secureString
Set-GitHubAuthentication -Credential $cred
Uses the API token stored in the password field of the provided credential object for
authentication, and stores it in a file on the machine as a SecureString for use in
future PowerShell sessions.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Set-GitHubAuthentication -SessionOnly
Prompts the user for their GitHub API Token, but keeps it in memory only for the duration
of this PowerShell session.
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Set-GitHubAuthentication -Credential $cred -SessionOnly
Uses the API token stored in the password field of the provided credential object for
authentication, but keeps it in memory only for the duration of this PowerShell session..
RELATED LINKS
SYNOPSIS
Allows the user to configure the API token that should be used for authentication
with the GitHub API.
SYNTAX
Set-GitHubAuthentication [[-Credential] <PSCredential>] [-SessionOnly] [-WhatIf] [-Confirm] [<CommonParameters>]
DESCRIPTION
Allows the user to configure the API token that should be used for authentication
with the GitHub API.
The token will be stored on the machine as a SecureString and will automatically
be read on future PowerShell sessions with this module. If the user ever wishes
to remove their authentication from the system, they simply need to call
Clear-GitHubAuthentication.
The Git repo for this module can be found here: http://aka.ms/PowerShellForGitHub
PARAMETERS
-Credential <PSCredential>
If provided, instead of prompting the user for their API Token, it will be extracted
from the password field of this credential object.
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-SessionOnly [<SwitchParameter>]
By default, this method will store the provided API Token as a SecureString in a local
file so that it can be restored automatically in future PowerShell sessions. If this
switch is provided, the file will not be created/updated and the authentication information
will only remain in memory for the duration of this PowerShell session.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Set-GitHubAuthentication
Prompts the user for their GitHub API Token and stores it in a file on the machine as a
SecureString for use in future PowerShell sessions.
-------------------------- EXAMPLE 2 --------------------------
$secureString = ("<Your Access Token>" | ConvertTo-SecureString)
$cred = New-Object System.Management.Automation.PSCredential "username is ignored", $secureString
Set-GitHubAuthentication -Credential $cred
Uses the API token stored in the password field of the provided credential object for
authentication, and stores it in a file on the machine as a SecureString for use in
future PowerShell sessions.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Set-GitHubAuthentication -SessionOnly
Prompts the user for their GitHub API Token, but keeps it in memory only for the duration
of this PowerShell session.
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Set-GitHubAuthentication -Credential $cred -SessionOnly
Uses the API token stored in the password field of the provided credential object for
authentication, but keeps it in memory only for the duration of this PowerShell session..
RELATED LINKS