Am able to create a new service endpoint using
And also able to grant it with Pipeline Permissions using below
curl --request PATCH -H "Content-Type: application/json" -u $user:$token -d "@newpatch.json" https://dev.azure.com/$org/$project/_apis/pipelines/pipelinePermissions/endpoint/$connection_id\?api-version\=5.1-preview.1
But when am trying to use the service connection in the pipeline it is giving me below error
Failed to query service connection API: 'https://management.azure.com/subscriptions/resourcegroups?api-version=2019-05-01'. Status Code: 'BadRequest', Response from server: '{"error":{"code":"InvalidSubscriptionId","message":"The provided subscription identifier 'resourcegroups' is malformed or invalid."}}'
I have tried with - update restproxy but I still see the error, not sure on the body for the script
Please help
Passing service connection as a variable at terraform task level caused the Issue.
Since it is not supported at task level, it has to be defined globally in the yaml or from variable groups. Issue has been resolved doing it.