Azure DevOps Service 中 Azure Resource Manager 手動設定

Where
5 min readApr 14, 2021

在透過 Azure DevOps Service 部屬/管理 Azure 上的資源時,會需要授權 Azure DevOps Service Azure 上的存取權限,此篇描述如何透過手動的方式進行設定,適用於當管理 Azure 的 admin 及 Azure DevOps Service 為不同人時之場景。

設定 App Registration

  • 先搜尋 Azure Active Directory (AAD)
  • 在 AAD > App Registry 選擇 New registration

這個動作就有點像是,透過新增一個虛擬的 account 出來,賦予這個 account 一些特定權限,再指派這個 account 給 Azure DevOps Service 來使用,如果需要在自行開發的 app 上使用 Azure Active Directory 的驗證服務也是透過此來做設定

  • 在 App registration 的頁面填選資料,目前給 Azure DevOps Service 使用的話不需要填寫 redirect URI

指派權限

接下來,我們要將這組 account 指派給 access 資源的 subscription

  • 搜尋你的 subscription,點選它進去
  • 先記下 Subscription ID 和 Subscription Name,最後設定 Azure DevOps Service 時會使用到
  • 找到左邊欄位 Settings 中的 My permission,點選 " Click here to view complete access details for this subscription. "
  • 點選 Add > Add role assignment,這裡我先將 Role 指派為 Contributor,當然你可以根據你的 Azure DevOps Service 所需要的權限去做更進一步的權限管理設定,Select 的地方搜尋你剛建立的 App registration 的名字並點選,即可指派完成

Azure DevOps Service connection 設定

  • 回到 AAD,在 Manage 的欄位中找到 App registrations,搜尋剛剛建立的 app 並點選進去

將 Application (client) ID、Directory (tenant) ID 記下

  • 在 Manage 欄位中的 Certificates & secrets 新增一個 client secret,可以自行設定到期時間,並將這組 client secret 記下

到 Azure DevOps Service 你的組織中,選擇你要使用到 Azure 的 Project 中選擇 Project Setting > Service Connections > New Service Connection

  • 類型選擇 Azure Resource Manager,驗證方法選擇 Service Principle (manual)

填入剛剛取得的 Subscription ID、 Subscription Name、Client ID、Client Secret,並自行設定你的 Service connection name,可以先進行 Verify 確認可以 access 到 Azure 上的資源,最後點選 Verify and Save 便設定完成

接著回到你要設定資源的 Pipeline 裡面,便可以找到此 Connection 使用

透過此方法,可以讓即使 Azure DevOps Service 的使用者沒有 Azure 上足夠的存取權限,也能透過先由 Azure admin (或擁有足夠權限的人員)先行設定Azure DevOps Service 上面的connection,讓 Azure DevOps Service 的user可以進行後續的操作行為

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response