Skip to content

Commit

Permalink
Write "Google Cloud Identityを始める"
Browse files Browse the repository at this point in the history
  • Loading branch information
fukasawah committed Jan 26, 2023
1 parent 4246b4c commit 709acac
Show file tree
Hide file tree
Showing 47 changed files with 292 additions and 0 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
292 changes: 292 additions & 0 deletions content/posts/2023/01/google-cloud-identity/index.md
@@ -0,0 +1,292 @@
---
title: "Google Cloud Identityを始める"
date: "2023-01-27T05:20:42+09:00"
draft: false
toc: true
images:
tags:
- Google Cloud
- Google Cloud Identity
---


初GCPです。

背景
--------------

Google Cloud(GCP)では何かと組織を作れ作れといわれる。

Google Cloud IdentityはGoogle Workspaceとは別らしい(ちょっとよくわかってない。Workspaceのほうが上位互換っぽい?)

Google Cloudにおいては組織なしでもやっていけるが、違いを見るためにまずは作ってみることにした。

用意するもの
--------------

- Google アカウント(Google Cloud Identityの組織を作るまでの繋ぎ。メールアドレスはなんでも)
- ドメイン(DNS設定が行えるぐらいでよさそう)



手順
-----------------

### 1. Cloud Identity と組織

Cloud Identityアカウントを作る必要がある。

[https://console.cloud.google.com/cloud-setup/overview] にアクセス

![](images/index/2023-01-27-02-10-15.png)

「設定を開始する」を押す。

![](images/index/2023-01-27-02-11-24.png)

- 初めて利用する
- Cloud Identityに申し込む

![](images/index/2023-01-27-02-12-03.png)

別タブでしょっぱい画面が出る。

![](images/index/2023-01-27-02-12-50.png)

![](images/index/2023-01-27-02-13-59.png)

ドメインを指定。(メールを受け取れる必要はなさそう)

![](images/index/2023-01-27-02-14-48.png)

確認される。

どうでもいい通知確認。「利用しない」でよい。

![](images/index/2023-01-27-02-15-09.png)

![](images/index/2023-01-27-02-15-23.png)



![](images/index/2023-01-27-02-16-34.png)

管理者アカウントを設定する模様。後で二段階認証を設定して封印するはずなので適当に。

![](images/index/2023-01-27-02-17-24.png)

Cloud Identityアカウントが作成された

![](images/index/2023-01-27-02-21-35.png)

そのまま作業を続行する。

#### 1.ドメインを保護する

![Cloud Identityの設定](images/index/2023-01-27-02-22-34.png)

「1.ドメインを保護する」から始める。保護を押す。

![](images/index/2023-01-27-02-23-39.png)


![](images/index/2023-01-27-02-24-21.png)

登録事業者というのは、ドメインを取ったところ(ドメインレジストラ)とか、ドメインを管理しているところを指す。
私はGoogle Domainsで.devドメインを取っているが、Azure DNSに委任しているので、Azure DNS側に設定することとなる。

手順2に移動する。

![](images/index/2023-01-27-02-31-36.png)

TXTレコードを設定しろと言われるので設定する。

![](images/index/2023-01-27-02-30-12.png)

TTLは適当でよいが、コピペミスするとキャッシュが残ってしまい都合が悪いので5分とか短めが良いだろう。問い合わせる人はGoogleぐらいなのでTTLは短くてもWebに害はないだろう。

(でもこれ、ちんたらやってたら、適当なドメインのTXTをスキャンしまくっている悪い人に、TXTレコードにあるコードを盗み見ることができてしまい、自分のドメインのようにCloud Identityを設定できてしまわないか?Cloud Identityアカウントが被って弾かれるから大丈夫なのか?)

設定したら、手順2の画面に戻り「ドメインを保護」をクリック。

![](images/index/2023-01-27-02-36-53.png)

完了した。

#### 2. 新しいユーザを作成する

チュートリアル的にユーザを作成してみる。

後述するGoogle cloud用の管理ユーザとして使う事を想定して「自分自身」を作ってみるとよいだろう。

![](images/index/2023-01-27-02-38-33.png)


![](images/index/2023-01-27-02-43-04.png)

一応予備のメールアドレスの重複が気になったので、エイリアスを払い出している。Microsoftアカウント(Outlookなど)を使っている場合、[https://account.live.com/AddAssocId] からエイリアスの作成が行えるはず。

![](images/index/2023-01-27-02-45-15.png)

作成できた。


![](images/index/2023-01-27-02-46-16.png)

一覧に戻ると追加されたことが確認できる。

### 試しにメンバーのアカウントでログイン

![](images/index/2023-01-27-02-55-07.png)

Googleアカウントのようにログインできる。

![](images/index/2023-01-27-02-57-18.png)

ためしにGmailにアクセスしてみたが使えない。それはそうか。

![](images/index/2023-01-27-02-58-34.png)

Google CloudのConsoleにはアクセスできた。有効化してないのもあるが、二段階認証は強制させたい。


### 管理者ユーザでログインする

作業を進めるためログインしなおす。(最初のGoogleアカウントではダメらしい?)



### 2.ユーザとグループ


![](images/index/2023-01-27-03-07-29.png)

![管理グループの作成画面](images/index/2023-01-27-03-08-04.png)

管理グループは必要に応じて作る。「全てのグループを作成」でとりあえず作っておく。
正直細かすぎるように感じるが、合わないなと思ったら後で消したりすればよい。また、この時点で即座にロールが割り当たるわけではなく、それはこの後の作業で行われる。

![](images/index/2023-01-27-03-09-59.png)

管理ユーザのためのユーザを作る。この作業自体はただのユーザ作成でこの後の管理グループに入れることで管理ユーザとなる。
例えば自身を含めると良いだろう。上記の手順の流れで作っている場合はそれを使えば良いので不要だし、他に作業を共にしている信頼できる人(上司やお客様のお偉い様など)を追加する。

![](images/index/2023-01-27-03-13-36.png)

グループにユーザを追加していく。最初は最小限必要な人がよいがユースケースによって変わる。「組織」の規模でも違うため何とも言えない。

gcp-organization-adminsは強い権限なので、数人に留めておくとよいだろう。プロジェクトリーダー的な存在が居れば入れておくとよさそう。

gcp-developersは開発メンバー(インフラはあまり触らない人ら)を入れておいたりする。

今回はとりあえず全部に1人追加した。(gcp-organization-adminsが全てを兼ねるので全て入れる意味はない)

![](images/index/2023-01-27-03-18-50.png)

メンバーはグループ作成者と追加作業したメンバーの2人になっている。作業に応じて変わる。


### 3.管理者権限


(2)で作ったグループにロールを割り当てて権限を与えていく。

![組織管理者権限を設定する](images/index/2023-01-27-03-27-43.png)

![](images/index/2023-01-27-03-28-55.png)

ここは手順に従ってやっていくだけ。

ただ、正しいグループ名でもエラーになった。この場合はページを開きなおしたりして作業をやりなおすと上手くいくかもしれない。


### 4.お支払い

「請求先アカウント」を作る作業。

![](images/index/2023-01-27-03-37-20.png)

クレジットカードを使いたいので左を選ぶ。無料トライアル用のアカウントを作るだけなので請求は発生しないらしい。実際はどういう請求が良いかはニーズで選ぼう。

![](images/index/2023-01-27-03-51-26.png)

別画面で請求先アカウントを作ると確定できる。


### 5.リソース階層とアクセスの設定

ダレてきた。

5~7までは一通り設定した後、「デプロイまたはダウンロード」からTerraformファイル(tar.gz)のダウンロードかデプロイするか選んで行う。

今回はここでプロジェクトの割り当て増加のリクエストを行い、何もしない。

![](images/index/2023-01-27-03-38-49.png)

![](images/index/2023-01-27-03-53-22.png)

プロジェクトをいくつか作っていくのが流儀らしく、プロジェクト数の上限の制限(クォータ)に引っかかる可能性がある。デフォルトは5だったかな?
なので、「割り当て増加のリクエスト」を行う。

![](images/index/2023-01-27-03-56-10.png)

申請したら階層構造に応じたプロジェクトが作れるが、今回は何もしない。

![](images/index/2023-01-27-03-59-06.png)

### 6.ネットワーキング

今回は何もしない。


### 7.ロギングの一元化

![](images/index/2023-01-27-04-01-27.png)


![](images/index/2023-01-27-04-02-20.png)

(4)で請求先アカウントを作っておかないと設定できなかった。

![](images/index/2023-01-27-04-03-25.png)


### 8.モニタリング

作業内容がなさそうだった。

### 9.セキュリティ

![](images/index/2023-01-27-04-07-35.png)

Cloud Security Command Center を開く。

![](images/index/2023-01-27-04-08-52.png)

プランが表示される。とりあえず無料がいいですね。

![](images/index/2023-01-27-04-10-26.png)

プレミアムとあるものは無効化しておく。

![](images/index/2023-01-27-04-10-52.png)


![ロールが付与された](images/index/2023-01-27-04-11-39.png)


![](images/index/2023-01-27-04-13-08.png)

組織のポリシーの設定は [組織のポリシーのリスト](https://console.cloud.google.com/iam-admin/orgpolicies/list) で設定していく。
ここでは特に何もしない。

### 10.サポート

よくあるサポートのプランを変えませんか、という話。

[https://console.cloud.google.com/support/offerings] から変更できる。デフォルトは無料のベーシックサポート。

無料が良いのでこのままにする。

一通りやってみたがわからないことだらけ。今日はここまで。

0 comments on commit 709acac

Please sign in to comment.