Background: I work for the Center for Educational Technology (CET) in Israel on a team that supports the development of state-of-the-art textbooks and digital content. As a DevOps practitioner, it's essential for me to discover smarter and faster ways of implementing all things DevOps. It's also important to share what we learn with the community. Let me tell you about a solution I discovered for updating a hook configuration in Azure Development via an API script for PowerShell.
Goals: Global change multiple hooks in Azure Development with Jenkins.
Solution & Results: We have about 250 hooks in Azure Dev at the moment. When developers "checkin" their code, the hook automatically runs the job, and Jenkins deploys the code to the servers.
After the last update to Jenkins, all hooks stopped working. We needed to change the basic password to a token because of security measures. For this, we had two solutions for change:
For now, we have a solution in Jenkins to change parameters in all of our hooks.
Knowing that a token can live one year, I started to work on an API solution. However, I found a bug in Azure API after the 'changed password to token hooks' didn't work and opened a Microsoft support ticket. After one month of talking to support agents, they told me that "changing the password is not possible via the Rest API." Frustrated, I tried one more solution: I changed the basic user password to the same token. And it started to work!
I hope this helps someone avoid what I went through. I was happy that using Jenkins pipeline: