New-GitHubCodeSecurityConfiguration

SYNOPSIS

Create a code security configuration

SYNTAX

Default (Default)

New-GitHubCodeSecurityConfiguration [-Org] <string> -Name <string> [-Description <string>]
 [-AdvancedSecurity <string>] [-CodeSecurity <string>] [-DependencyGraph <string>]
 [-DependencyGraphAutosubmitAction <string>] [-DependencyGraphAutosubmitActionOptions <Object>]
 [-DependabotAlerts <string>] [-DependabotReachability <string>]
 [-DependabotSecurityUpdates <string>] [-DependabotDelegatedAlertDismissal <string>]
 [-CodeScanningOptions <Object>] [-CodeScanningDefaultSetup <string>]
 [-CodeScanningDefaultSetupOptions <Object>] [-CodeScanningDelegatedAlertDismissal <string>]
 [-SecretProtection <string>] [-SecretScanning <string>] [-SecretScanningPushProtection <string>]
 [-SecretScanningDelegatedBypass <string>] [-SecretScanningDelegatedBypassOptions <Object>]
 [-SecretScanningValidityChecks <string>] [-SecretScanningNonProviderPatterns <string>]
 [-SecretScanningGenericSecrets <string>] [-SecretScanningGenericSecretsPushProtection <string>]
 [-SecretScanningDelegatedAlertDismissal <string>] [-SecretScanningExtendedMetadata <string>]
 [-PrivateVulnerabilityReporting <string>] [-Enforcement <string>] [-Accept <string>] [-WhatIf]
 [-Confirm]

Body

New-GitHubCodeSecurityConfiguration [-Org] <string> -Body <Object> [-Name <string>]
 [-Description <string>] [-AdvancedSecurity <string>] [-CodeSecurity <string>]
 [-DependencyGraph <string>] [-DependencyGraphAutosubmitAction <string>]
 [-DependencyGraphAutosubmitActionOptions <Object>] [-DependabotAlerts <string>]
 [-DependabotReachability <string>] [-DependabotSecurityUpdates <string>]
 [-DependabotDelegatedAlertDismissal <string>] [-CodeScanningOptions <Object>]
 [-CodeScanningDefaultSetup <string>] [-CodeScanningDefaultSetupOptions <Object>]
 [-CodeScanningDelegatedAlertDismissal <string>] [-SecretProtection <string>]
 [-SecretScanning <string>] [-SecretScanningPushProtection <string>]
 [-SecretScanningDelegatedBypass <string>] [-SecretScanningDelegatedBypassOptions <Object>]
 [-SecretScanningValidityChecks <string>] [-SecretScanningNonProviderPatterns <string>]
 [-SecretScanningGenericSecrets <string>] [-SecretScanningGenericSecretsPushProtection <string>]
 [-SecretScanningDelegatedAlertDismissal <string>] [-SecretScanningExtendedMetadata <string>]
 [-PrivateVulnerabilityReporting <string>] [-Enforcement <string>] [-Accept <string>] [-WhatIf]
 [-Confirm]

ALIASES

This cmdlet has the following aliases,

  • Get-GHNewCodeSecurityConfiguration

DESCRIPTION

The New-GitHubCodeSecurityConfiguration cmdlet invokes the POST method of the /orgs/{org}/code-security/configurations endpoint (Create a code security configuration)

Creates a code security configuration in an organization.

The authenticated user must be an administrator or security manager for the organization to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the ‘write:org’ scope to use this endpoint.

Endpoint: POST /orgs/{org}/code-security/configurations API version: 2026-03-10

EXAMPLES

EXAMPLE 1

New-GitHubCodeSecurityConfiguration -Org 'github' -Name 'octo-org recommended settings' -Body @{ key = 'value' }

Invokes POST /orgs/{org}/code-security/configurations

EXAMPLE 2

New-GitHubCodeSecurityConfiguration -Org 'github' -Body @{ name = 'octo-org recommended settings' }

Sends the request body from a hashtable, parameters override the keys of -Body

PARAMETERS

-Accept

The Accept header (media type) of the request Default value: application/vnd.github+json

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-AdvancedSecurity

The enablement status of GitHub Advanced Security features. ‘enabled’ will enable both Code Security and Secret Protection features. [!WARNING] ‘code_security’ and ‘secret_protection’ are deprecated values for this field. Prefer the individual ‘code_security’ and ‘secret_protection’ fields to set the status of these features.

Body property [ advanced_security ]

Default value: disabled

Allowed values: ‘enabled’, ‘disabled’, ‘code_security’, ‘secret_protection’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Body

The whole request body as a hashtable or object. Keys that are also available as parameters are overwritten by the parameter values

Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Body
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-CodeScanningDefaultSetup

The enablement status of code scanning default setup

Body property [ code_scanning_default_setup ]

Default value: disabled

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-CodeScanningDefaultSetupOptions

Feature options for code scanning default setup

Body property [ code_scanning_default_setup_options ]

Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-CodeScanningDelegatedAlertDismissal

The enablement status of code scanning delegated alert dismissal

Body property [ code_scanning_delegated_alert_dismissal ]

Default value: not_set

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-CodeScanningOptions

Security Configuration feature options for code scanning

Body property [ code_scanning_options ]

Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-CodeSecurity

The enablement status of GitHub Code Security features.

Body property [ code_security ]

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- cf
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-DependabotAlerts

The enablement status of Dependabot alerts

Body property [ dependabot_alerts ]

Default value: disabled

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-DependabotDelegatedAlertDismissal

The enablement status of Dependabot delegated alert dismissal. Requires Dependabot alerts to be enabled.

Body property [ dependabot_delegated_alert_dismissal ]

Default value: disabled

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-DependabotReachability

The enablement status of reachability analysis for Dependabot. Only available for organizations with access to reachability analysis. Requires Dependabot alerts to be enabled when set to ‘enabled’. Must be ‘disabled’ when Dependabot alerts is ‘disabled’. ‘not_set’ leaves existing repository settings unchanged.

Body property [ dependabot_reachability ]

Default value: disabled

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-DependabotSecurityUpdates

The enablement status of Dependabot security updates

Body property [ dependabot_security_updates ]

Default value: disabled

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-DependencyGraph

The enablement status of Dependency Graph

Body property [ dependency_graph ]

Default value: enabled

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-DependencyGraphAutosubmitAction

The enablement status of Automatic dependency submission

Body property [ dependency_graph_autosubmit_action ]

Default value: disabled

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-DependencyGraphAutosubmitActionOptions

Feature options for Automatic dependency submission

Body property [ dependency_graph_autosubmit_action_options ]

Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Description

A description of the code security configuration

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Enforcement

The enforcement status for a security configuration

Default value: enforced

Allowed values: ‘enforced’, ‘unenforced’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Name

The name of the code security configuration. Must be unique within the organization.

Required unless -Body is used

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Body
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
- Name: Default
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Org

The organization name. The name is not case sensitive.

Path parameter [ org ]

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-PrivateVulnerabilityReporting

The enablement status of private vulnerability reporting

Body property [ private_vulnerability_reporting ]

Default value: disabled

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-SecretProtection

The enablement status of GitHub Secret Protection features.

Body property [ secret_protection ]

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-SecretScanning

The enablement status of secret scanning

Body property [ secret_scanning ]

Default value: disabled

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-SecretScanningDelegatedAlertDismissal

The enablement status of secret scanning delegated alert dismissal

Body property [ secret_scanning_delegated_alert_dismissal ]

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-SecretScanningDelegatedBypass

The enablement status of secret scanning delegated bypass

Body property [ secret_scanning_delegated_bypass ]

Default value: disabled

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-SecretScanningDelegatedBypassOptions

Feature options for secret scanning delegated bypass

Body property [ secret_scanning_delegated_bypass_options ]

Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-SecretScanningExtendedMetadata

The enablement status of secret scanning extended metadata

Body property [ secret_scanning_extended_metadata ]

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-SecretScanningGenericSecrets

The enablement status of Copilot secret scanning

Body property [ secret_scanning_generic_secrets ]

Default value: disabled

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-SecretScanningGenericSecretsPushProtection

The enablement status of generic secrets push protection

Body property [ secret_scanning_generic_secrets_push_protection ]

Default value: disabled

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-SecretScanningNonProviderPatterns

The enablement status of secret scanning non provider patterns

Body property [ secret_scanning_non_provider_patterns ]

Default value: disabled

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-SecretScanningPushProtection

The enablement status of secret scanning push protection

Body property [ secret_scanning_push_protection ]

Default value: disabled

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-SecretScanningValidityChecks

The enablement status of secret scanning validity checks

Body property [ secret_scanning_validity_checks ]

Default value: disabled

Allowed values: ‘enabled’, ‘disabled’, ‘not_set’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-WhatIf

Runs the command in a mode that only reports what would happen without performing the actions.

Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- wi
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  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

Objects with properties named like the path parameters can be piped to this function

{{ Fill in the Description }}

System.String

{{ Fill in the Description }}

OUTPUTS

The response of the GitHub API (objects

{{ Fill in the Description }}

NOTES

OperationId: code-security/create-configuration Category: code-security / configurations