Connect-GitHubAccount¶
SYNOPSIS¶
Connects to GitHub.
SYNTAX¶
UAT (Default)¶
Connect-GitHubAccount [-Mode <string>] [-Scope <string>] [-ClientID <string>] [-Enterprise <string>]
[-Owner <string>] [-Repository <string>] [-HostName <string>] [-Silent] [-NotDefault] [-PassThru]
[<CommonParameters>]
PAT¶
Connect-GitHubAccount -UseAccessToken [-Enterprise <string>] [-Owner <string>]
[-Repository <string>] [-HostName <string>] [-Silent] [-NotDefault] [-PassThru]
[<CommonParameters>]
Token¶
Connect-GitHubAccount -Token <Object> [-Enterprise <string>] [-Owner <string>]
[-Repository <string>] [-HostName <string>] [-Silent] [-NotDefault] [-PassThru]
[<CommonParameters>]
GitHub App using a KeyVault Key Reference¶
Connect-GitHubAccount -ClientID <string> -KeyVaultKeyReference <string> [-AutoloadInstallations]
[-Enterprise <string>] [-Owner <string>] [-Repository <string>] [-HostName <string>] [-Silent]
[-NotDefault] [-PassThru] [<CommonParameters>]
GitHub App using a PrivateKey¶
Connect-GitHubAccount -ClientID <string> -PrivateKey <Object> [-AutoloadInstallations]
[-Enterprise <string>] [-Owner <string>] [-Repository <string>] [-HostName <string>] [-Silent]
[-NotDefault] [-PassThru] [<CommonParameters>]
ALIASES¶
This cmdlet has the following aliases, {{Insert list of aliases}}
DESCRIPTION¶
Connects to GitHub using one of the following logon methods: - a personal access token - device code login (interactive user login) - a system access token (for GitHub Actions) - a GitHub App using JWT or installation access token
For device flow / device code login: PowerShell requests device and user verification codes and gets the authorization URL where you will enter the user verification code. In GitHub you will be asked to enter a user verification code at https://github.com/login/device. PowerShell will keep polling GitHub for the user authentication status. Once you have authorized the device, the app will be able to make API calls with a new access token.
EXAMPLES¶
EXAMPLE 1¶
Connect-GitHubAccount
Connects to GitHub using a device flow login. If the user has already logged in, the access token will be refreshed.
EXAMPLE 2¶
$env:GH_TOKEN = '***'
Connect-GitHubAccount
Connects to GitHub using the access token from environment variable, assuming unattended mode.
EXAMPLE 3¶
Connect-GitHubAccount -UseAccessToken
! Enter your personal access token: *************
User gets prompted for the access token and stores it in the context. The token is used when connecting to GitHub.
EXAMPLE 4¶
Connect-GitHubAccount -Mode 'OAuthApp' -Scope 'gist read:org repo workflow'
Connects to GitHub using a device flow login and sets the scope of the access token.
PARAMETERS¶
-AutoloadInstallations¶
Automatically load installations for the GitHub App.
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: GitHub App using a KeyVault Key Reference
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
- Name: GitHub App using a PrivateKey
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-ClientID¶
The client ID for the GitHub App to use for authentication.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: GitHub App using a KeyVault Key Reference
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
- Name: GitHub App using a PrivateKey
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
- Name: UAT
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Enterprise¶
The default enterprise to use in commands.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-HostName¶
The host to connect to. Can use $env:GITHUB_SERVER_URL to set the host, as the protocol is removed automatically. Example: github.com, github.enterprise.com, msx.ghe.com
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases:
- Server
- Host
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-KeyVaultKeyReference¶
The KeyVault Key Reference that can sign JWTs for the GitHub App.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: GitHub App using a KeyVault Key Reference
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Mode¶
Choose between authentication methods, either OAuthApp or GitHubApp. For more info about the types of authentication visit: Differences between GitHub Apps and OAuth apps
Type: System.String
DefaultValue: GitHubApp
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: UAT
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-NotDefault¶
Make the connected context NOT the default context.
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Owner¶
Set the default owner to use in commands.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases:
- Organization
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-PassThru¶
Passes the context object to the pipeline.
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-PrivateKey¶
The private key that is used to sign JWTs for the GitHub App.
Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: GitHub App using a PrivateKey
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Repository¶
Set the default repository to use in commands.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Scope¶
The scope of the access token, when using OAuth authentication. Provide the list of scopes as space-separated values. For more information on scopes visit: Scopes for OAuth apps
Type: System.String
DefaultValue: gist read:org repo workflow
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: UAT
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Silent¶
Suppresses the output of the function.
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases:
- Quiet
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Token¶
An access token to use for authentication. Can be both a string or a SecureString. Supports both personal access tokens (PAT) and GitHub App installation access tokens (IAT). Example: 'ghp_1234567890abcdef' Example: 'ghs_1234567890abcdef'
Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Token
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-UseAccessToken¶
The user will be prompted to enter the token.
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: PAT
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters¶
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS¶
OUTPUTS¶
System.Void¶
{{ Fill in the Description }}
NOTES¶
Authenticating to the REST API