3.9.3.6. 서비스 주체 생성

OpenShift Container Platform과 해당 설치 프로그램은 Azure Resource Manager를 통해 Microsoft Azure 리소스를 생성해야 하므로 이를 대표하는 서비스 주체를 생성해야 합니다.

사전 요구 사항

  • Azure CLI를 설치 또는 업데이트합니다.
  • jq 패키지를 설치합니다.
  • Azure 계정은 사용하는 서브스크립션에 대한 필요한 역할을 갖습니다.

프로세스

  1. Azure CLI에 로그인합니다.

    $ az login

    인증 정보를 사용하여 웹 콘솔에서 Azure에 로그인합니다.

  2. Azure 계정이 서브스크립션을 사용하는 경우, 올바른 서브스크립션을 사용하고 있는지 확인합니다.

    1. 사용 가능한 계정 목록을 보고 클러스터에 사용하려는 서브스크립션의 tenantId 값을 기록합니다.

      $ az account list --refresh

      출력 예

      [
        {
          "cloudName": "AzureCloud",
          "id": "9bab1460-96d5-40b3-a78e-17b15e978a80",
          "isDefault": true,
          "name": "Subscription Name",
          "state": "Enabled",
          "tenantId": "6057c7e9-b3ae-489d-a54e-de3f6bf6a8ee",
          "user": {
            "name": "you@example.com",
            "type": "user"
          }
        }
      ]

    2. 활성 계정 세부 사항을 보고 tenantId 값이 사용하려는 서브스크립션과 일치하는지 확인합니다.

      $ az account show

      출력 예

      {
        "environmentName": "AzureCloud",
        "id": "9bab1460-96d5-40b3-a78e-17b15e978a80",
        "isDefault": true,
        "name": "Subscription Name",
        "state": "Enabled",
        "tenantId": "6057c7e9-b3ae-489d-a54e-de3f6bf6a8ee", 1
        "user": {
          "name": "you@example.com",
          "type": "user"
        }
      }

      1
      tenantId 매개변수의 값이 올바른 서브스크립션의 UUID인지 확인합니다.
    3. 올바른 서브스크립션을 사용하지 않는 경우, 활성 서브스크립션을 변경합니다.

      $ az account set -s <id> 1
      1
      <id>에 사용하려는 서브스크립션의 id 값을 대체합니다.
    4. 활성 서브스크립션을 변경한 경우 계정 정보를 다시 표시합니다.

      $ az account show

      출력 예

      {
        "environmentName": "AzureCloud",
        "id": "33212d16-bdf6-45cb-b038-f6565b61edda",
        "isDefault": true,
        "name": "Subscription Name",
        "state": "Enabled",
        "tenantId": "8049c7e9-c3de-762d-a54e-dc3f6be6a7ee",
        "user": {
          "name": "you@example.com",
          "type": "user"
        }
      }

  3. 이전 출력의 tenantIdid 매개변수 값을 기록합니다. OpenShift Container Platform 설치 중에 이러한 값이 필요합니다.
  4. 계정에 대한 서비스 주체를 생성합니다.

    $ az ad sp create-for-rbac --role Contributor --name <service_principal> 1
    1
    <service_principal>을 서비스 주체에 할당할 이름으로 바꿉니다.

    출력 예

    Changing "<service_principal>" to a valid URI of "http://<service_principal>", which is the required format used for service principal names
    Retrying role assignment creation: 1/36
    Retrying role assignment creation: 2/36
    Retrying role assignment creation: 3/36
    Retrying role assignment creation: 4/36
    {
      "appId": "8bd0d04d-0ac2-43a8-928d-705c598c6956",
      "displayName": "<service_principal>",
      "name": "http://<service_principal>",
      "password": "ac461d78-bf4b-4387-ad16-7e32e328aec6",
      "tenant": "6048c7e9-b2ad-488d-a54e-dc3f6be6a7ee"
    }

  5. 이전 출력의 appIdpassword 매개변수 값을 기록합니다. OpenShift Container Platform 설치 중에 이러한 값이 필요합니다.
  6. 서비스 주체에 추가 권한을 부여합니다.

    • 클러스터가 해당 구성 요소에 대한 인증 정보를 할당할 수 있도록 항상 ContributorUser Access Administrator 역할을 앱 등록 서비스 주체에 추가해야 합니다.
    • mint 모드에서 CCO (Cloud Credential Operator)를 작동하려면 앱 등록 서비스 주체에도 Azure Active Directory Graph/Application.ReadWrite.OwnedBy API 권한이 필요합니다.
    • passthrough 모드에서 CCO를 작동하기 위해 앱 등록 서비스 주체는 추가 API 권한이 필요하지 않습니다.

    CCO 모드에 대한 자세한 내용은 Red Hat Operators 참조 콘텐츠의 Cloud Credential Operator 부분을 참조하십시오.

    1. User Access Administrator 역할을 할당하려면 다음 명령을 실행합니다.

      $ az role assignment create --role "User Access Administrator" \
          --assignee-object-id $(az ad sp list --filter "appId eq '<appId>'" \
             | jq '.[0].id' -r) 1
      1
      <appId>를 서비스 주체의 appId 매개변수 값으로 대체합니다.
    2. Azure Active Directory Graph 권한을 할당하려면 다음 명령을 실행합니다.

      $ az ad app permission add --id <appId> \ 1
           --api 00000002-0000-0000-c000-000000000000 \
           --api-permissions 824c81eb-e3f8-4ee6-8f6d-de7f50d565b7=Role
      1
      <appId>를 서비스 주체의 appId 매개변수 값으로 대체합니다.

      출력 예

      Invoking "az ad app permission grant --id 46d33abc-b8a3-46d8-8c84-f0fd58177435 --api 00000002-0000-0000-c000-000000000000" is needed to make the change effective

      이 명령으로 부여한 특정 권한에 대한 자세한 내용은 Windows Azure Active Directory 권한에 대한 GUID 테이블을 참조하십시오.

    3. 권한 요청을 승인합니다. 계정에 Azure Active Directory 테넌트 관리자 역할이 없는 경우 조직의 지침에 따라 테넌트 관리자가 권한 요청을 승인해 주도록 요청하십시오.

      $ az ad app permission grant --id <appId> \ 1
           --api 00000002-0000-0000-c000-000000000000
      1
      <appId>를 서비스 주체의 appId 매개변수 값으로 대체합니다.