Artifacts應用:讓外部合作夥伴也可以從Private nuget安裝Package
前面幾篇文章都在提Azure DevOps Artifacts,也就是如何利用這個服務來達成私有化的nuget套件庫。雖然私有的套件庫可以不需要將公司專案的package上傳到網路公開的nuget.org,但是如果是有部份外包的專案,或是有外部合作夥伴的時候,要如何讓他們也可以存取私有的套件庫呢?
前面的「Azure DevOps Artifacts簡介」文章中提到,Azure DevOps Artifacts feed有分為Organization範圍與Project範圍的feed,Project範圍的自然就是Azure DevOps中建立的Project裡面的成員才能存取,Organization的存取權限範圍則是比Project還大,在組織中的成員都可以存取,而在Create new feed對話框內的Visibility選項中更看到了Azure Active Directory關鍵字:

看到Azure Active Directory(AAD)就好辦了,我們可以將外部的成員加入到AAD裡面作為來賓身份,之後就可以在Azure DevOps Artifact feed裡面去設定他的權限。(這邊可能需要擁有Azure Portal的部份功能權限的帳號才能操作)
首先進到Azure Portal的畫面,接著找到Azure Active Directory服務:

為了管理方便,可以先新增一個群組,之後再加入外部的使用者:





從AAD建立完群組並且加入使用者之後,並不能直接在Artifact feed的Permissions裡面去選擇AAD的群組來加入,必須要在Project或Organization的Permissions設定中去新增一個Group(或用現有的Group)把上面建立的AAD Group(NugetReader)加入:

這裡為了方便區別,所以特別在Group名稱上使用不同的名字。在Project或Organization設定裡把AAD Group加入之後,再到Artifact feed的Permissions裡面把Project或Organization的Group加到Artifact feed裡面:

完成之後就可以請對方試試看在VS裡面是否能夠搜尋得到nuget package了。當然,也要一併提供給對方feed連線的url,如同前面文章提到的(Connect to feed裡的提示),請對方在VS的Package Manager Settings設定Package source之後,第一次瀏覽應該會出現登入畫面(別忘了先收Email完成確認邀請動作):

登入之後應該就可以成功看到Artifact feed上面的Package了:

原文連結泰克哪裡去
Like my work? Don't forget to support and clap, let me know that you are with me on the road of creation. Keep this enthusiasm together!