I'm using the CI available with VS Team Services to build a web app and deploy to Azure. It essentially uses the "local git repo" method described here: https://azure.microsoft.com/en-us/documentation/articles/web-sites-publish-source-control/
I run the deployment using a PowerShell script like so:
$sourcePath = Get-Location
cd ..
mkdir deploy
cd deploy
$deployPath = Get-Location
git init
git config core.safecrlf false
git remote add azure <fill-in>
git pull azure master --quiet
git rm -rf .
git clean -fxd
git reset
Copy-Item $sourcePath\* $deployPath -Recurse
git add -A
git commit -m "Deploy"
git push azure master --porcelain
What I noticed was that several git operations like push and pull cause PowerShell to see errors (even though the operations are successful). This is why I used the "quiet" and "porcelain" options.
Now the tricky part is, after the push operation, Azure will run some deployment scripts automatically. This causes the PowerShell to see errors, even if the operation was successful, and...I have no way to control this.
How to get PowerShell to properly recognize true errors?
By the way, if you see a better or more efficient way, I'll be happy to learn about it.