English 中文(简体)
• 如何在Devops变量组中添加新的秘密(从Keter Vault)
原标题:How to add new secrets (from Azure Key Vault) to the variable group in Azure Devops

我建造了一条有权力的管道,以创建新的秘密。 同样的关键数字与DevOps变量小组(管道/图书馆/变量组)相关联。

我已经手工增添了几个关键因素,但我希望能够增加新的秘密,在管道部署期间,我也向变数群体建立了“钥匙”。

Do I have to make use of REST API? https://learn.microsoft.com/en-us/rest/api/azure/devops/distributedtask/variablegroups/add?view=azure-devops-rest-7.1

或者,我能否利用权力或其他东西?

问题回答

如果你想把新秘密自动添加到变数组中,那么你需要把“DevOps REST”二字放在管道工作上:

  1. 要求使用“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>是列入变数组的秘密的实际名称。

  2. 更新答复机构,插入新的秘密物体,作为“<>条码>中可变的 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
            }
        }
    }
    
  3. 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.






相关问题
Windows Azure WorkerRole response

I am working on an Azure demo to run Powershell in a worker role. In my web role I add the name of the Powershell script which is to be run to a CloudQueue object. I can print the script output to ...

Windows Azure WebRole stuck in a deployment loop

I ve been struggling with this one for a couple of days now. My current Windows Azure WebRole is stuck in a loop where the status keeps changing between Initializing, Busy, Stopping and Stopped. It ...

Getting a token for Windows Azure

We are looking at Windows Azure, but getting a token appears to be hard now, at least that s what I m seeing in web searches. Anyone tried it or know how to accelerate that process? Any idea how long ...

Developing Azure .Net 4.0 Applications

Presently .Net 4.0 is not supported on Azure. This thread indicates that you will not be able to use .Net 4.0 with VS 2010 until it is supported in the cloud. http://social.msdn.microsoft.com I d ...

.NET 4.0 on Windows Azure?

My google-fu is failing me on this one. As a possible solution to Unit Testing .NET 3.5 projects using MStest in VS2010 (but I ve put this in a seperate question because it s kind of unrelated): Is ...

热门标签