ARM Azure DevOps Development

Azure DevOps – Commit URL On Azure Resource Tag (Part 2)

Part2_Image

In my previous part I built a solution where I used https://rebrandly.com service to shorten the commit URL and add to a tag on a storage account. The problem might be, that you don’t want to us a public link shortening service like https://rebrandly.com  or any other like https://bit.ly etc. you might be afraid of security, the URL history, company policy or anything else is blocking you from using such a service.

I was searching the internet if there is already a solution for that. And yes, I found a brilliant solution from Microsoft Senior Cloud Developer Advocade Jeremy Likness. He has written a serverless URL shortener based on Azure Functions, which is well  documented on his GitHub repository, how to deploy it.

I am just going to follow his instructions and press the “Deploy to Azure” button, providing the necessary information we need. Note here, I am using the same resource group as in my previous part 1

image

…see the deployment in action…

image

…after successful installation, got to the resource group and see all the deployed resources…

image

…navigate to the Function App, in my case I called it “commit” and go to “UrlIngest” function…

image

…copy the function URL…

image

…you should get something like this…

https://commit.azurewebsites.net/api/UrlIngest?code=23Dasc3QJmnKcWA6aovakuIXrpqREXRmBCcgonHL4zrtvt0Ydr5Igg==

…take these two parts. We are going to store them in Azure Key Vault from which we have created in part 1

  • FUNCTION-URL: https://commit.azurewebsites.net
  • FUNCTION-KEY: 23Dasc3QJmnKcWA6aovakuIXrpqREXRmBCcgonHL4zrtvt0Ydr5Igg==

…add them to the Key Vault…

image

…in Azure DevOps I created a new repository “URL-ShortenerPrivat” in the same Azure DevOps project and added the same ARM template from part 1 to it…

image

…in addition I copied the same pipeline to this repo and made some minor changes…

image

…the reason is, the module we published “ShortenURL” in part 1, contains another function “New-PrivateURL” which will call the Azure Function which we have deployed in the beginning of this post. If everything is done correctly the pipeline will run successfully…

image

…and we will see the Azure Functions link on the storage account tag….

image

…which will redirect to the commit in the Azure DevOps repository…

image

If we go to the storage account which is used by the Azure Function we can see the storage table and all entries. So you can keep this data private…

image

…additionally Applications Insights is being deployed for that function where we can get very detailed information, how the application is running…

image

I think Jeremy Likness has done a fantastic job writing this function. Implementing into Azure DevOps was also a piece of cake, when you have done the first part of this 2-part blog post series.

You can find the files on GitHub, hope this helps!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.