Category: Azure

Moving an Azure DevOps repo to use Github Actions instead

In this blog post, I am going to take an existing web application that resides in Azure DevOps and port it to build and deploy within GitHub and use GitHub Actions to build and deploy the same site to GitHub.

Here you can see I have a website in Visual Studio which is currently pointing at a repository inside Azure Devops.

And here is what it looks like inside Visual Studio 2019 with the connection to Azure DevOps.

Now I am going to remove the connection from the Azure DevOps repo by clicking on remove like so:-

When I click on remove, this removes the connection from the code to the Azure DevOps repository. Then I go to the Sync area and it now asks me where do I want to push the code to.

This time I choose to Publish to GitHub.

Give the new repository a name (for within GitHub) and press Publish

This will push the code to a new GitHub repository called AzureGlobalBootCamp2020 which you can now see below.

Now we need to create a GitHub Action so that the code is built and pushed to Azure (like it was from within Azure DevOps previously).

From within your new GitHub repo click on Actions at the top.

I then chose Setup a new workflow yourself

This will take you to a screen and create a main.yaml file.

name: Deploy ASP.NET Core app to Azure Web App

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - '*'
# CONFIGURATION
# For help, go to https://github.com/Azure/Actions
#
# 1. Set up the following secrets in your repository:
#   AZURE_WEBAPP_PUBLISH_PROFILE
#
# 2. Change these variables for your configuration:
env:
  AZURE_WEBAPP_NAME: AzureGlobalBootCamp2020     # set this to your application's name
  AZURE_WEBAPP_PACKAGE_PATH: '.'                 # set this to the path to your web app project, defaults to the repository root
  DOTNET_VERSION: '3.1.100'                      # set this to the dot net version to use

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:

      # Checkout the repo
      - uses: actions/checkout@master
      
      # Setup .NET Core SDK
      - name: Setup .NET Core
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: ${{ env.DOTNET_VERSION }} 
      
      # Run dotnet build and publish
      - name: dotnet build and publish
        run: |
          dotnet build --configuration Release
          dotnet publish -c Release -o '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp' 
          
      # Deploy to Azure Web apps
      - name: 'Run Azure webapp deploy action using publish profile credentials'
        uses: azure/webapps-deploy@v2
        with: 
          app-name: ${{ env.AZURE_WEBAPP_NAME }} # Replace with your app name
          publish-profile: ${{ secrets.azureWebAppPublishProfile  }} # Define secret variable in repository settings as per action documentation
          package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp'

# For more samples to get started with GitHub Action workflows to deploy to Azure, refer to https://github.com/Azure/actions-workflow-samples

I then pasted this into the main.yaml file and changed the following:-

AZURE_WEBAPP_NAME: AzureGlobalBootCamp2020
DOTNET_VERSION: ‘3.1.100
publish-profile: ${{ secrets.azureWebAppPublishProfile }}

The last entry above publish-profile requires you to create a new secret in GitHub under Settings -> Secrets and call it azureWebAppPublishProfile and you need to paste in the publishing profile from your Azure Web App

The above screen shows me in the Azure Portal and I’ve clicked into my Azure App Service and when I click on Get Publish Profile it downloads the content of the Publish profile which I paste into the new Secret with GitHub.

And with that we are done, GitHub will kick off the GitHub Action and built and deploy my web app changes when I publish any change to GitHub right into Azure for me.

Note
To read more on using GitHub Actions with .Net you can read more on GitHub here -> https://github.com/actions/setup-dotnet

Feel free to comment below if this is useful or if you have any feedback etc.



Azure Weekly

Azure is an ever-changing platform, its amazing just how often its updated, it’s also really hard to stay up to date with the numerous new services and the changes to existing services.

It’s also very hard to keep abreast of all of the Azure news throughout the year, months and weeks.

Azure weekly is a great way to keep up to date with what’s new each and every week.

Azure weekly is brought to you by the folks from Endjin – they do a number of amazing things with Azure and are a company worth checking out.

They are up to week 264 at this time of writing this article, so what are you waiting for? – go find out what’s new recently, subscribe and don’t miss a thing going forward.

You can also contribute content to Azure Weekly, so if you have a blog post and have Azure content contact them and you may end up appearing in the weekly newsletter.

You can also follow Azure Weekly on twitter at @AzureWeekly

Please let me know what you think of Azure Weekly.


Tags:


AzureCharts.com

I have been familiar with Azurecharts.com long before it was mentioned on twitter by Mark Russinovich who you are all hopefully following on twitter.

The site is written by Alexey Polkovnikov and is one I keep coming back to and always point people to. There is a lot of very useful links on here.

The site has a number of features that I wanted to cover and you can read about what it can be used for in the about page.

The main concept is that you can go here and see what is new in each area of Azure right down to the actual azure service itself and this is continually updated for you.

I wanted to cover the areas which I think are incredibly useful that you may have missed within the site, so lets dive right in.

Highlights
Highlights allow you to choose a job role and it will highlight the azure services most likely to be of interest for that role.

Overview
The overview lists all of the Azure services and you can click on each to be taken to the relevant azure docs page to learn more.

SLA
The SLA section shows you the SLA (service level agreement for Azure services which has an SLA.

Status
This screen shows us which services are Generally Available or in Preview.

Timeline
This screen shows us the timeline for when we can expect to see the feature rolled out to the particular region show for the service.

Regions
This screen allows us to compare services by region, and will shows us the timeline and the status for the service you click on.

Presence
Presence shows us how many regions the service you click on is present within and can show future availability stats for some services.

Solutions
Solutions are where you can choose a service and then from the drop-down at the top make a choice and it will take you to the docs for the selection you make – so for example, if I select the Azure Cosmos DB service I can then choose from the solutions drop down like so: –

Stories
Stories are where you can select an azure service and read customer stories on how they implemented the service and has some very interesting ideas and usages of the technology.

Fun
Within the fun screen there is an azure quiz and an azure menu covering starters, main dishes, and desserts, go take a look.

Summary
In summary, this is a great site with a tonne of useful information and one to share with your team or on twitter, etc. – huge thanks to Alexey for putting this together and keeping it up to date.



Microsoft Learn

Microsoft Learn in my eyes is highly under rated, I want to show you why there is more to it than you have probably realised.

Learning Paths
Learning paths are a great way to explore a topic, there are currently around 1000 learning paths, so what are you waiting for, there is something for everyone in there, which means you. #alwaysbelearning

Filter
You can filter your learning by –

  • Product
  • Roles
  • Levels
  • Type (Learning Paths or Modules)

Bookmarks
Bookmark your learning choices and come back to them, you owe it to yourself to have learning goals and to finish the learning path or module, don’t start it and leave it, become good at finishing and not good at starting.

Collections
Collections are where you can group your own collection of learning paths and modules which might relate to a specific learning goal you have. This is perfect if you are studying for an exam or want to know more about a more general topic like server-less as an example.

Achievements
If you complete a module within a learning path you earn points and badges along the way and you can see these listed under achievements which can be found under your profile and looks like so: –

I myself have realised I haven’t been using Microsoft Learn for a while and there is a lot of great new content which I am off to check out now.

Let me know which level your on – I’m currently on level 8.



Global Azure BootCamp 2020 – Glasgow Edition

Saturday April 25th, 2020 is the date for this years Global Azure BootCamp Glasgow edition, in conjunction with the Glasgow Azure user Group.

You can read about last year’s event and learn about whats involved and the format for the day, were looking for 6 speakers to come to Glasgow on April 25th and give a 60 minute talk on anything Azure related.


The call for speakers page to submit a talk is now open

The page for signing up to attend will go live Monday 20/01/2010.

We hope to see you there!



Azure Advent Calendar wrap-up

The #azureadventcalendar was a shared idea between myself and @pixel_robots

Some quick stats as I write this: –

15,800 thousand YouTube views
15,000 website views from over 120 countries
1,300 hours of videos watched
1,200 subscribers

We set out with the idea of asking the Azure community for 25 videos / blog posts with a Christmas theme, with the idea in mind that it would give people the chance to show off their skills, learn new skills and contribute back to the community over December.

We asked people via twitter who would like to contribute to this idea in the middle of September to give people time to decide if they could manage to contribute in December (a 20-30 minute video isn’t easy, especially towards that time of year).

Before we knew it we had more than 25 filled up and it was clear that this might be a bit more popular than first thought, we increased it to 50 and before you know it we had increased it to 75. In order to avoid too many duplicate subjects we decided to cap it at 75.

Wow! 75 videos/blog post contributions would be pretty amazing.

We considered several ideas but wanted to keep it simple: –

  • Anyone could contribute
  • We could have had advertisements but kept it without as it was a community project for the community by the community and this was important to us both.

I would create the website and keep that up to date daily, and chase people for content, Richard was looking after our YouTube channel and scheduling the videos to go out at midnight.

Richard also designed the logo which I loved the second I saw it and we decided to use this as the brand and he also created video thumbnails for each video for people to use on twitter, videos and blog posts.

Now the real reason this was successful was due to the contributors, we were both blown away by the quality of content from each contributor and the Christmas theme just made it pretty cool.

Richard and I both had our Twitter and LinkedIn full with tweets and articles with the above logo in it, very regularly throughout the month which was super cool to see.

Setup
The website was basic and I was updating it daily with links to blog posts and using a very simple .Net Web app, and using Azure DevOps to build and deploy the web app to Azure, I also made use of staging slots to deploy the changes, check the links etc worked and then swapped the staging slot for production – super easy to do and well worth it.

Richard had the YouTube channel setup with the logo and scheduled the videos to be released using a schedule which was pretty sweet. He also created a thumbnail for each video for the contributor to use as they saw fit.

Highlights
The highlights for me were many, but one that stands out for me personally was seeing people who had never taken part in something like this, some had never created a blog post, many had never created a video before.

The hard part of the project was chasing people for content, especially when it was mid December and everyone is busy!

To end this post I want to mention the next project which you should keep your eye on by Joe Carlyle and Thomas Thornton called the #AzureSpringCleanup – personally looking forward to see more azure community coming together and creating awesome new content.

Please leave any feedback you have on the #azureadventcalendar below.




Azure Resource GitHub Repository

I have started a GitHub repository for a place to put the following so that the community can benefit from resources I have came across from the community.

I’m looking for others to contribute to this so that the community has a place to find helpful info – please take a look, add your study guides, useful links and more in here and help grow the useful resources we come across.

If you have an Azure Exam Study guide let me know and I’ll add a link to it from the Exam folder to your blog or create a quick pull request.

If you have any useful Azure Resources which aren’t listed then please either let me know or create a quick pull request.

I’m gong to be adding to this over time throughout the year, I’m looking for contributors so we can grow this out to be something useful to a lot of people.

Link to the GitHub Repository:- https://github.com/gsuttie/AzureResources




Azure Advent Calendar – Week 1 recap

Week 1 of the Azure Advent Calendar has come and gone and we have seen some incredible content.

Content covered includes: –

An Azure Poem, Azure Governance, Azure Logic Apps, Azure Service Health, Azure Container Instance, Azure Devops Pipelines, Azure NetApp Files, Azure Certification Paths, Azure AKS, Azure API Manangement, Azure Lighthouse, Azure Site Recovery, Azure Functions, Azure WebApps, Azure MFA, Azure Role Based Certification,  Being Successful in Azure, Azure Migrate, Azure Key Vault, AKS monitoring with Prometheus and Terraform for Azure.

Phew that’s a lot to learn about in just 1 week, there is a lot more to come so please subscribe to our dedicated YouTube Channel 

So far we have over 700 subscribers, and there has been over 350 hours of videos watched which is absolutely awesome.

The Azure Advent Calendar website has been view in over 120 countries around the globe and had almost 6 thousand hits in the last 90 days.

We wanna take this time to thank everyone for taking part and hope that everyone is enjoying the #azureadventcalendar so far, we appreciate all of the tweets, LinkedIn coverage etc its been a blast so far, loving all the Christmas jumpers on show etc.

Thanks all from Gregor and Richard aka @Pixel_Robots



Azure Resource Graph Dashboards

I attended a session at Experts Live EU 2019 which was about Azure initialization from zero to hero: on-boarding, governance & resources deployment and one of the subject was Azure Resource Graph.

Azure Resource Graph  is a service in Azure that is designed to extend Azure Resource Management by providing efficient and performant resource exploration with the ability to query at scale across a given set of subscriptions so that you can effectively govern your environment.

With Azure Resource Graph you can write queries against your Azure resource so you can gain some very insightful information into your resources., before it wasn’t possible to see all of your resources if you had more than 2000. Queries that you write can be kept private or shared, shared queries are stored within a Resource Group for other users to run.

Resource Graph Explorer allows you to open existing queries, create new queries and run them within the portal and see the results.

An example of a query would be like so: –

I wont show the results for obvious reasons 👀

The really nice benefit I see from Azure Resource Graph is that you can save these to a dashboard and share the dashboard with members of your team/company.

At Experts Live EU @ExchangeGoddess shared an example dashboard which is a simple json file.

The beautiful thing is that the json can be exported and imported into your subscription(s), it doesn’t store subscription id’s etc as it only contains the queries. I was able to take this file and import it into a brand new dashboard and instantly see a very useful dashboard which looks like the following: –

 

 

 

Clicking on the charts take you to the actual query which produces the dashboard, the queries are written in a language called Kusto. You can learn more about Kusto on Pluralsight.

You can grab the json file which @ExchangeGoddess kindly shared from my github repo and then within dashboards insode the Azure portal simply use the upload capability to upload the json file and bingo you’ll have a nice new dashboard where you can learn about your resources and learn more from the existing Kusto queries within the dashboard you now have.

Big thanks to @ExchangeGoddess for sharing this, enjoy!

 



Azure Web App Staging Slots

With this years Azure Advent Calendar I made some site improvements and also upgraded the site from .Net 2.2 to 3.0, the code built and ran locally just fine, I push it to production and boom! – sites down, not good for a number of reasons.

The take away from this is I knew better, I tried to push some changes which in hindsight could easy have broken the site and by running it locally I thought its all good, the site has no tests as its content only.

By upgrading the site and attempting to add in Azure Application configuration I ran into some nuget package issues which I though I had resolved.

Get to the point of the blog post already Gregor!

Azure has a thing called Azure Deployment Slots for Web apps and with this feature we can have the following: –

  • Have 2 copies of the site running at the same time (one prod, one staging)
  • Deploy new features to Staging ad then test (however you test)
  • If all is good you switch slots so that the new version is now the prod version and the old prod version is switched into the staging version – if anything is borked then switch back and your back to good.

That’s the short version of what deployment slots are used for, I encourage you to take a look at them and I have this now setup for the azure advent calendar and wont be so careless next time.