diff --git a/gh-cli/README.md b/gh-cli/README.md index e17fcf0..6d79f60 100644 --- a/gh-cli/README.md +++ b/gh-cli/README.md @@ -931,6 +931,19 @@ The list will contain the repository name, source (CODEOWNERS file), and kind of Repositories with no CODEONWERS files or CODEOWNERS errors will not be listed. +### get-organization-database-id-for-vnet.sh + +Retrieves the databaseId of an organization for use with VNet injection configuration. + +Usage: + +```shell +./get-organization-database-id-for-vnet.sh +``` + +> [!NOTE] +> See [Configuring private networking for GitHub-hosted runners in your organization](https://docs.github.com/en/organizations/managing-organization-settings/configuring-private-networking-for-github-hosted-runners-in-your-organization#1-obtain-the-databaseid-for-your-organization) for more information on using the databaseId with VNet injection + ### get-organization-id.sh Get the organization ID used for other GraphQL calls. Use the login of the Organization as the input. diff --git a/gh-cli/get-organization-database-id-for-vnet.sh b/gh-cli/get-organization-database-id-for-vnet.sh new file mode 100755 index 0000000..f101ed7 --- /dev/null +++ b/gh-cli/get-organization-database-id-for-vnet.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# This script retrieves the databaseId of your organization to be used in the VNet injection scripts +# https://docs.github.com/en/organizations/managing-organization-settings/configuring-private-networking-for-github-hosted-runners-in-your-organization#1-obtain-the-databaseid-for-your-organization + +if [ -z "$1" ]; then + echo "Usage: $0 " + echo "Example: ./get-organization-database-id-for-vnet.sh joshjohanning-org" + exit 1 +fi + +org="$1" + +gh api graphql -H X-Github-Next-Global-ID:1 -f organization="$org" -f query=' +query ($organization: String!) + { organization(login: $organization) { + login + databaseId + } +} +' diff --git a/gh-cli/get-organization-id.sh b/gh-cli/get-organization-id.sh index 2347684..0b177d4 100755 --- a/gh-cli/get-organization-id.sh +++ b/gh-cli/get-organization-id.sh @@ -2,7 +2,7 @@ if [ -z "$1" ]; then echo "Usage: $0 " - echo "Example: ./get-enterprise-id.sh joshjohanning-org" + echo "Example: ./get-organization-id.sh joshjohanning-org" exit 1 fi @@ -14,7 +14,7 @@ query ($organization: String!) { organization(login: $organization) { login name - id + id } } '