Skip to content

Commit a301afc

Browse files
committed
feat: add script to retrieve organization databaseId for VNet injection
1 parent d527b88 commit a301afc

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

gh-cli/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,19 @@ The list will contain the repository name, source (CODEOWNERS file), and kind of
931931

932932
Repositories with no CODEONWERS files or CODEOWNERS errors will not be listed.
933933

934+
### get-organization-database-id-for-vnet.sh
935+
936+
Retrieves the databaseId of an organization for use with VNet injection configuration.
937+
938+
Usage:
939+
940+
```shell
941+
./get-organization-databaseId-for-vnet.sh <organization>
942+
```
943+
944+
> [!NOTE]
945+
> 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
946+
934947
### get-organization-id.sh
935948

936949
Get the organization ID used for other GraphQL calls. Use the login of the Organization as the input.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# This script retrieves the databaseId of your organization to be used in the Vnet injection scripts
4+
# 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
5+
6+
if [ -z "$1" ]; then
7+
echo "Usage: $0 <org>"
8+
echo "Example: ./get-enterprise-id.sh joshjohanning-org"
9+
exit 1
10+
fi
11+
12+
org="$1"
13+
14+
gh api graphql -f organization="$org" -f query='
15+
query ($organization: String!)
16+
{ organization(login: $organization) {
17+
login
18+
databaseId
19+
}
20+
}
21+
'

0 commit comments

Comments
 (0)