授予存取權

中樞管理員可以授權特定使用者,在與中樞相關聯的其他專案中建立 Spoke,並保留對中樞接受哪些 Spoke 的完整控制權。您必須明確接受,Spoke 才會啟用。如有需要,你也可以隨時拒絕語音。

如要授予其他使用者在與中樞相關聯的其他專案中建立 Spoke 的權限,可以將 roles/networkconnectivity.groupUser 角色授予該使用者。如果使用者在中心具有 groupUser 角色,透過 Identity and Access Management (IAM) 資源階層,該使用者會自動在中心的所有群組中具有該角色。中樞管理員也可以撤銷使用者的存取權。

事前準備

開始設定前,請先詳閱下列各節。

建立或選取專案

為方便設定 Network Connectivity Center,請先找出有效的專案。

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Install the Google Cloud CLI.

  5. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  6. To initialize the gcloud CLI, run the following command:

    gcloud init
  7. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  8. Make sure that billing is enabled for your Google Cloud project.

  9. Install the Google Cloud CLI.

  10. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  11. To initialize the gcloud CLI, run the following command:

    gcloud init
  12. 如果您使用 Google Cloud CLI,請使用 gcloud config set 指令設定專案 ID。

    gcloud config set project PROJECT_ID

    PROJECT_ID 替換為專屬專案 ID。

    這個頁面的 gcloud CLI 指令假設您已設定專案 ID。

  13. 如要確認專案 ID 設定正確無誤,請使用 gcloud config list 指令

    gcloud config list --format='text(core.project)'
  14. 啟用 Network Connectivity API

    您必須先啟用 Network Connectivity API,才能使用 Network Connectivity Center 執行任何工作。

    控制台

    如要啟用 Network Connectivity API,請按照下列步驟操作:

    1. 在 Google Cloud 控制台中,前往「Network Connectivity Center」頁面。

      前往 Network Connectivity Center

    2. 按一下「啟用」

    或者,您也可以使用Google Cloud 控制台 API 程式庫啟用 API,如「啟用 API」一文所述。

    管理跨專案中樞的 Spoke 建立存取權

    下列各節說明如何授予、撤銷或查看權限,以便在與中樞不同的專案中建立輪輻。

    將中樞的 groupUser 角色授予其他使用者

    如要將中樞裝置的 networkconnectivity.groupUser 角色授予其他使用者,請按照下列步驟操作。

    主控台

    1. 在 Google Cloud 控制台中,前往「Network Connectivity Center」頁面。

      前往 Network Connectivity Center

    2. 在專案選單中選取專案。

    3. 按一下「Hubs」(中樞) 分頁標籤。

    4. 在中心清單中,選取要新增存取權的中心。

    5. 按一下 [權限]

    6. 在「權限」對話方塊中,按一下「新增主體」

    7. 輸入要新增的管理員使用者名稱。

    8. 在「管理角色」對話方塊中,從「網路連線」角色清單選取要指派的角色,例如「Spoke 管理員」

    9. 按一下 [儲存]

    gcloud

    執行 gcloud network-connectivity hubs add-iam-policy-binding 指令

    gcloud network-connectivity hubs add-iam-policy-binding HUB_NAME \
        --member=MEMBER_DETAILS \
        --role='roles/networkconnectivity.groupUser'
    
    

    更改下列內容:

    • HUB_NAME:輪輻的中心,例如 my-hub
    • MEMBER_DETAILS:要授予存取權的使用者詳細資料。如要詳細瞭解 ID 和格式,請參閱「主體 ID」。

    撤銷使用者的中心 groupUser 角色

    如要撤銷使用者的中樞 roles/networkconnectivity.groupUser 角色,請按照下列步驟操作。

    gcloud

    執行 gcloud network-connectivity hubs remove-iam-policy-binding 指令

    gcloud network-connectivity hubs remove-iam-policy-binding HUB_NAME \
        --member=MEMBER_DETAILS \
        --role='roles/networkconnectivity.groupUser'
    
    

    更改下列內容:

    • HUB_NAME:輪輻的中心,例如 my-hub
    • MEMBER_DETAILS:要移除存取權的使用者詳細資料。如要詳細瞭解 ID 和格式,請參閱「主體 ID」。

    查看使用者的權限

    如要查看授予使用者的中心權限,請按照下列步驟操作。

    gcloud

    執行 gcloud network-connectivity hubs get-iam-policy 指令

    gcloud network-connectivity hubs get-iam-policy HUB_NAME
    

    HUB_NAME 替換為要查看權限的中心名稱,例如 my-hub

    後續步驟