1. On https://dev.azure.com/<Organization name>, for example https://dev.azure.com/SAS-Engineer, select Organization settings

    oidc_guide_1.png

  2. Download Azure DevOps organizations

    oidc_guide_2.png

  3. In the downloaded CSV file, find your organization ID

    oidc_guide_3.png

    Now the OIDC provider is vstoken.dev.azure.com/<organization ID>, for example, vstoken.dev.azure.com/61c028b9-510c-4f84-bfb2-f48d33b6b542.

    The Audiences hard-coded value = api://AzureADTokenExchange

  4. Now navigate to the AWS IAM website, create a new identity provider with well-known values.

    oidc_guide_4.png

    The result is the same as below

    image.png

  5. Don’t forget to update the role that you need to assume via OIDC (for example, LabCICDApplicationRole and LabCICDInfraRole) trust policy. Add the statement below

            {
                "Sid": "AllowTeamAzureDevOps",
                "Effect": "Allow",
                "Principal": {
                    "Federated": "arn:aws:iam::917566871600:oidc-provider/vstoken.dev.azure.com/61c028b9-510c-4f84-bfb2-f48d33b6b542"
                },
                "Action": "sts:AssumeRoleWithWebIdentity",
                "Condition": {
                    "StringEquals": {
                        "vstoken.dev.azure.com/61c028b9-510c-4f84-bfb2-f48d33b6b542:aud": "api://AzureADTokenExchange"
                    }
                }
            }
    

That’s it.

Cách lấy Organization ID khác

Bạn không cần cài phần mềm gì cả, chỉ cần trình duyệt web:

  1. Đăng nhập vào Azure DevOps của bạn bình thường.
  2. Mở một tab mới, copy và dán đường dẫn sau vào thanh địa chỉ (nhớ thay TÊN_TỔ_CHỨC bằng tên org của bạn): https://dev.azure.com/TÊN_TỔ_CHỨC/_apis/connectionData(Ví dụ: https://dev.azure.com/nguyenthanhtung/_apis/connectionData)
  3. Trình duyệt sẽ hiện ra một đoạn text dài (định dạng JSON).
  4. Bạn dùng tính năng tìm kiếm (Ctrl + F) và tìm chữ: instanceId.
  5. Giá trị nằm ngay sau nó chính là Organization ID bạn cần.