0
votes

I'm trying to deploy an Azure app from a script. Azure has been set up for external git repository deployment. I've set the deploy key (Azure's SSH public key) into Gitlab

The following works

curl -X POST 
     -H "Content-type: application/json"
     -d "{'format':'basic', 'url':'https://GITLABUSER:[email protected]/MYTEAM/MYGIT.git'}"
     -u "AZUREUSERNAME:AZUREPASSWORD"  
     https://MYSITE.scm.azurewebsites.net/deploy

is there a way to not specify the Gitlab user and password in the request since Azure already knows the address of the Git to pull from ?

1

1 Answers

0
votes

Looks like it won't work without username/password, per the code which explicitly checks for their presence when it handles GitLab.

The better way to do this is to use the ARM sync API, instead of talking directly to the (lower level) Kudu API. e.g. there is a sample here on how to call it with PowerShell:

Invoke-AzureRmResourceAction -ResourceGroupName $ResourceGroupName -ResourceType Microsoft.Web/sites -Name $SiteName -Action sync -ApiVersion $WebAppApiVersion -Force

And you can call the same API via any mechanism that supports making ARM API calls.

Previous (incorrect) answer

Try passing the ssh url instead of https in the payload. I believe it will do the right thing.