简体   繁体   中英

Azure Devops - How to reset Resource Group in Edit service connection

In renewing the secret key for a service connection, I accidentally also set Resource group to a specific group, whereas previously it was left blank so it had access to the whole subscription.

I want to revert it back so it has access to the whole subscription, but I cannot seem to clear out the Resource group , it seems like once it's set, it cannot be cleared out.

Short of deleting this service connection and creating a new one with same name, is there some other way to set Resource Group to blank/empty spaces? I could not find any az cli or ps command. I know I could manually grant access to the service principals but then it could be misleading from the UI perspective since it only shows one resource group .

在此处输入图像描述

We can't change the resource group to empty in the UI since it is by design.

There is a workaround to use Rest API to modify the service connection. Please see the similar case: https://developercommunity.visualstudio.com/t/Cant-change-resource-group-to-empty-in-/1396077 .

Get Request Body:

GET https://dev.azure.com/{organization}/{project}/_apis/serviceendpoint/endpoints/{endpointId}?api-version=7.1-preview.4

Update Service connection:

PUT https://dev.azure.com/{organization}/_apis/serviceendpoint/endpoints/{endpointId}?api-version=7.1-preview.4

Please set the scope as empty.

"authorization": {
    "parameters": {
        "tenantid": "",
        "serviceprincipalid": "",
        "authenticationType": "spnKey",
        "scope": "",  // this is the resource group
        "serviceprincipalkey": null
    },
    "scheme": "ServicePrincipal"
},

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM