如果你想把新秘密自动添加到变数组中,那么你需要把“DevOps REST”二字放在管道工作上:
要求使用“Variablegroups - Get,以便获得你希望更新的变量群体的回复机构。 从答复机构看,你可以认为其内容如下。
{
"name": "VarGroup",
"providerData": {
"serviceEndpointId": "<serviceEndpointId>",
"vault": "<Azure Key vault name>"
},
"type": "AzureKeyVault",
"variableGroupProjectReferences": [
{
"name": "VarGroup",
"projectReference": {
"id": "<project id>",
"name": "<project name>"
}
}
],
"variables": {
"<SecVar01>": {
"enabled": true,
"isReadOnly": false,
"isSecret": true
},
"<SecVar02>": {
"enabled": true,
"isReadOnly": false,
"isSecret": true
}
}
}
“:<SecVar01>
和“>>>>>;SecVar02>是列入变数组的秘密的实际名称。
更新答复机构,插入新的秘密物体,作为“<>条码>中可变的 node的成员。 例如,添加新的秘密“<SecVar03>
。
{
"name": "VarGroup",
"providerData": {
"serviceEndpointId": "<serviceEndpointId>",
"vault": "<Azure Key vault name>"
},
"type": "AzureKeyVault",
"variableGroupProjectReferences": [
{
"name": "VarGroup",
"projectReference": {
"id": "<project id>",
"name": "<project name>"
}
}
],
"variables": {
"<SecVar01>": {
"enabled": true,
"isReadOnly": false,
"isSecret": true
},
"<SecVar02>": {
"enabled": true,
"isReadOnly": false,
"isSecret": true
},
"<SecVar03>": {
"enabled": true,
"isReadOnly": false,
"isSecret": true
}
}
}
Then call the API "Variablegroups - Update" and pass the updated JSON body above as the Request Body of this API. Once this API call is succeeded, the new secret "<SecVar03>
" is added into the variable group.