mcpField
A
admin

admin

github.com/grafanaクラウド・DevOps2954.2k 回インストール1 日前に更新
リポジトリ

admin について

Grafana Cloud の組織やスタックを管理するためのガイドです。アクセス制御、SSO、サービスアカウント、API 操作の手順と参照情報を扱います。

主な機能

  1. 01Grafana Cloud スタックの作成と削除
  2. 02ユーザー、チーム、ロールの管理
  3. 03SSO の設定とログイン検証
  4. 04サービスアカウントとトークンの設定
  5. 05API、Terraform、SSO の参照情報

活用シーン

  1. 01Grafana Cloud の新規スタック構築
  2. 02チームの招待とロール割り当て
  3. 03SSO 設定とロールマッピングの確認
  4. 04サービスアカウントによるアクセス自動化

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/grafana/skills --skill admin

インストール後、Claude Code で/adminを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

references/
api-reference.md
sso.md
terraform.md

詳細

Grafana Cloud 管理

ドキュメント: https://grafana.com/docs/grafana-cloud/account-management.md

よくあるワークフロー

新しいスタックの設定
# 1. Create the stack via Cloud API
curl -X POST https://grafana.com/api/instances \
  -H "Authorization: Bearer <grafana-com-api-key>" \
  -H "Content-Type: application/json" \
  -d '{"name": "my-new-stack", "slug": "my-new-stack", "region": "us-east-0", "plan": "grafana-cloud-free"}'

# 2. Verify the stack is reachable (poll until 200)
until curl -fs https://my-new-stack.grafana.net/api/health > /dev/null; do sleep 2; done

# 3. Mint an admin service-account token (see § Service Accounts below)

# 4. Test the token
curl https://my-new-stack.grafana.net/api/org -H "Authorization: Bearer <token>"
# Returns 200 + org JSON → token works
チームのオンボーディング
  1. POST /api/org/invites でユーザーを招待します(ユーザーごとに curl を実行します。references/api-reference.md § Stack API を参照してください)
  2. POST /api/teams でチームを作成します
  3. POST /api/teams/{teamId}/members で各ユーザーを追加します
  4. チームに RBAC ロールを割り当てます(以下の § RBAC を参照してください)
  5. 確認します:GET /api/teams/{teamId}/members が想定どおりのユーザーリストを返すこと
SSO の設定(Okta / SAML / GitHub)
  1. references/sso.md からプロバイダー設定を選び、grafana.ini に追加します
  2. Grafana を再起動します
  3. 告知する前に、必ずシークレットウィンドウで検証してください:references/sso.md § Verifying SSO で、5 ステップの検証とロールマッピングのデバッグ手順を確認してください
スタックの削除(破壊的操作)
# 1. Delete via Cloud API
curl -X DELETE https://grafana.com/api/instances/{id} \
  -H "Authorization: Bearer <grafana-com-api-key>"

# 2. Verify the stack is gone (must return 404)
curl https://grafana.com/api/instances/{id} \
  -H "Authorization: Bearer <grafana-com-api-key>"

数秒後も GET が 200 を返す場合、削除は適用されていません。スタック ID と Cloud API キーを再確認してください。

組織とスタックの構造

Grafana Cloud Account
└── Organization (billing unit)
    ├── Stack 1 (prod)   → dedicated Grafana, Prometheus, Loki, Tempo URLs
    ├── Stack 2 (staging)
    └── Stack 3 (dev)
  • 組織:課金、ユーザー、API キー、スタックを管理する最上位アカウントです
  • スタック:独自の URL と認証情報を持つ、専用の Grafana + LGTM インスタンスです

ユーザーロール

ロールスコープ権限
Org Admin組織スタック、ユーザー、課金、API キーの管理
Adminスタックデータソース、プラグイン、ユーザー、プロビジョニング
Editorスタックダッシュボードやアラートの作成・編集
Viewerスタックダッシュボードの読み取り専用

RBAC

プロビジョニング YAML でカスタムロールと割り当てを定義します。

# provisioning/access-control/roles.yaml
apiVersion: 1
roles:
  - name: TeamDashboardEditor
    description: Edit dashboards within team folder
    permissions:
      - action: dashboards:read
        scope: folders:UID:team-folder
      - action: dashboards:write
        scope: folders:UID:team-folder
      - action: dashboards:create
        scope: folders:UID:team-folder
# provisioning/access-control/assignments.yaml
apiVersion: 1
roleAssignments:
  - roleName: TeamDashboardEditor
    users:
      - [email protected]
      - [email protected]
    teams:
      - platform-team

YAML をコミットして Grafana を再起動した後、ロールが適用されたことを確認します:GET /api/access-control/roles | jq '.[] | select(.name=="TeamDashboardEditor")'。

サービスアカウント

サービスアカウントは、プログラムによるアクセス(CI/CD、Terraform、エージェント)に推奨される方法です。

# 1. Create the service account
curl -X POST https://yourstack.grafana.net/api/serviceaccounts \
  -H "Authorization: Bearer <admin-token>" \
  -H "Content-Type: application/json" \
  -d '{"name": "terraform-provisioner", "role": "Admin", "isDisabled": false}'

# 2. Mint a token for it
curl -X POST https://yourstack.grafana.net/api/serviceaccounts/{id}/tokens \
  -H "Authorization: Bearer <admin-token>" \
  -H "Content-Type: application/json" \
  -d '{"name": "ci-token", "secondsToLive": 0}'

# 3. Verify the token works (test on a harmless endpoint)
curl https://yourstack.grafana.net/api/org \
  -H "Authorization: Bearer <new-token>"
# 200 + org JSON → token works. Anything else → re-check role assignment in step 1.

プロビジョニングでの同等の設定(YAML、宣言型):

# provisioning/access-control/service_accounts.yaml
apiVersion: 1
serviceAccounts:
  - name: alloy-writer
    orgId: 1
    role: Editor
    tokens:
      - name: alloy-token

リファレンス

  • references/sso.md — OAuth / SAML / GitHub OAuth の設定、5 ステップの SSO 検証手順、よくある障害
  • references/terraform.md — Terraform プロバイダーの設定、よく使われるリソースパターン(チーム、ユーザー、フォルダー、ダッシュボード)、ドリフトのトラブルシューティング
  • references/api-reference.md — Cloud API と Stack API の全エンドポイントリファレンス、監査ログのクエリ

コメント