For this issue , you can try to set approver through the Definitions - Update rest api.
You can add approver in "preDeployApprovals" argument. For example:
"preDeployApprovals": {
"approvals": [{
"approver": {
"id": "9f723013-a332-64e5-aea9-6e3ebxxxxx",
"displayName": "hughl01",
"isContainer": false
},
"isAutomated": false,
"isNotificationOn": false,
"rank": 1,
"id": 0
}]
},
Then you can set the pre-deploy approval to the user who submitted the release through pre-defined variables:
Release.RequestedFor
The display name of identity that triggered
the release.
Release.RequestedForId
The ID of identity that triggered the
release.
In the request body ,you can use $(Release.RequestedFor)
to dynamically get the name of the user who triggered the release and use it as the name of approver. The same goes for $(Release.RequestedForId)
.
Here are some references for you:
set approver with PowerShell
release pre-defined variables