It is time to share new reading notes. It is a habit I started a long time ago where I share a list of all the articles, blog posts, and books that catch my interest during the week.
If you think you may have interesting content, share it!
Hugo + VSCode + Docker = ❤️ (Aaryn Smith) - After an upgrade of Hugo or the theme, one of my site wasn't being generated anymore. Happy to to find a that devContainer, I will be able to investigate quickly.
Open Source
Windows Terminal Preview 1.19 Release (Christopher Nguyen) - Cool updates! I love that right-click web search! You know... when there is an error it will be so much efficient! An that was a community contribution! Fantastic!
How to rally support for your big idea (Modern Mentor) - Listening to winning strategies to make sure our biggest ideas have good start... It's always a good idea.
Community and Empowerment with Sharmadean Reid (A Bit of Optimism) - See ideas and challenges as a way to learn more, to learn maybe something different, to climb higher as Simon says, love it.
Good Monday, Already time to share new reading notes. Here is a list of all the articles, blog posts, and podcast episodes that catch my interest during the week.
If you think you may have interesting content, share it!
Build configuration for Azure Static Web Apps (craigshoemaker, anthonychu, Reshmi-Sriram, changeworld) - Continuous deployment is so powerful it is very useful to understand the options and how you can set your things together.
Create a Windows 10 development virtual machine (Thomas Maurer) - Great tutorial to create a dev environment.So useful when we need to create a specific context or use a different version to investigate client issues.
Visual Studio 2022 (Amanda Silver) - I'm always impressed by how new features are continuously added to VS. Such a great tool.
Miscellaneous
Why you should never quit too early ... (Donn Felker) - An inspiring post to help us persevere and time is hard. But also to try to step aside and have an open mindset.
State of the Azure SDK 2021 (Azure SDK Team) - So much good news! A ton of updates already done (do you know all of them?) And a very promising roadmap.
How to Stop Being Complacent (Influencer Entrepreneurs with Jenny Melrose) - A nice episode to "kick our butt" and get back on track. Yes, 2020 indeed brought tons of new challenges at all and every level. However. we must try to make this year better.
Who Owns Open-Source Software? (Coding Blocks) - Great discussion. Most of us, at some point, have to ask ourselves those questions (at least I know I did). It was very interesting listening to this episode and follow their thoughts.
631 - How to Explain a Gap in Your Résumé (Modern Mentor) - I have gaps in my resumé and I always been very comfortable about it. When I saw the title of this episode I thought maybe I should be concerned... Happy to know I was right!
Nice adventure. I wish I could see all those images, animals, and horizon. I had a good time reading this odyssey. And for the record, as a canoeist/ kayaker I was impressed by the upriver challenge.
You hear about that new GitHub Actions. Or maybe you didn't but would like to add a continuous integration, continuous deployment (CI-CD) to your web application. In this post, I will show you how to add a CI-CD to deploy automatically to Azure using the GitHub Actions.
What are GitHub Actions
GitHub Actions are automated workflows to do things. One of these could be a CI-CD. Using a workflow you could decide to compile and execute some unit tests at every push or pull request (PR). Another workflow could be that you deploy that application.
In this article, I will deploy a .Net Core application in Azure. However, you can use any languages you would like and deploy anywhere you like... I just needed to pick one :)
Now, let's get started.
Step 1 - The Code.
We need some code in a GitHub repo. Create a GitHub repo, clone it locally. And your app in it. I created mine with dotnet new blazorserver -n cloud5minsdemo -o src. Then commit and push.
Step 2 - Define the workflow
We got the code, now it's time to define our workflow. I will be providing all the code snippets required for the scenario cover in this post, but there is tons of template ready to be used available directly from your GitHub repository! Let's have a look. From your repository click on the Action tab, and voila!
When I wrote this post, a lot of available templates assumed the Azure resources already existed and you and adding a CI-CD to the mixt to automated your deployment. It's great but in my case, I was building a brand new web site so those didn't fit my needs. This is why I created my own template. The workflow I created was inspired by Azure/webapps-deploy. And there a lot of information also available on Deploy to App Service using GitHub Actions.
Let's add our template to our solution. GitHub will look in the folder .github/workflows/ from the root of the repository. Then create a file with the extension .yml
Here the code for my dotnet.yml, as any YAML file the secret is in the indentation as it is whitespace sensitive:
on: [push,pull_request]
env:
AZURE_WEBAPP_NAME: cloud5minsdemo # set this to your application's name
AZURE_GROUP_NAME: cloud5mins2
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# checkout the repo
- uses: actions/checkout@master
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.0.101
# dotnet build and publish
- name: Build with dotnet
run: dotnet build ./src --configuration Release
- name: dotnet publish
run: |
dotnet publish ./src -c Release -o myapp
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- run: |
az group create -n ${{ env.AZURE_GROUP_NAME }} -l eastus
az group deployment create -n ghaction -g ${{ env.AZURE_GROUP_NAME }} --template-file deployment/azuredepoy.json
# deploy web app using Azure credentials
- name: 'Azure webapp deploy'
uses: azure/webapps-deploy@v1
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
package: './myapp'
# Azure logout
- name: logout
run: |
az logout
The Agent
There is a lot in there let's start by the first line. The on: is to define the trigger, in this case, the workflow will be trigger at every push or PR.
The env: is where you can declare variables. It's totally optional, but I think it will help then templates are more complex or simply to reuse them easily.
Then comes the jobs: definition. In this case, we will use the latest version of Ubuntu as our build agent. Of course, in a production environment, you should be more specify and select the OS that matches your needs. This job will have multiples steps defined in the, you guess it, steps: section/
We specify a branch to work with and set up our agent by:
And it would be a better idea to set the version as an environment variable to be able to change it quickly.
The next two instructions are really .Net Core focus as they will build and package the application into a folder myapp. Of course, in the "section" you could execute some unit test or any other validation that you may find useful.
To have our GitHub Action to be able to create resources and deploy the code it needs to have access. The azure/login@v1 will let the Action login, using a Service Principal. In other words, we will create an authentication in the Azure Active Directory, with enough permission to do what we need.
This will create a Service Principal named "c5m-Frankdemo" with the role "contributor" on the subscription specified. The role contributor can do mostly anything except granting permission.
Because no resources already existed the GitHub Action will require more permission. If you create the Resource Group outside of the CI-CD, you could limit the access only to this specific resource group. Using this command instead:
The Azure CLI command will return a JSON. We will copy-paste this JSON into a GitHub secret. GitHub secrets encrypted secrets and allow you to store sensitive information, such as access tokens, in your repository. To access them go in the Settings of the repository and select Secrets from the left menu.
Click the Add a new secret button, and type AZURE_CREDENTIALS as the name. It could be anything, as long as you use that value in the YAML file describing the workflow. Put the JSON including the curly brackets in the Value textbox and click the save button.
Provisioning the Azure Resources
Now that the workflow has access we could execute some Azure CLI commands, but let's see what missing:
- run: |
az group create -n ${{ env.AZURE_GROUP_NAME }} -l eastus
az group deployment create -n ghaction -g ${{ env.AZURE_GROUP_NAME }} --template-file deployment/azuredepoy.json --parameters myWebAppName=${{ env.AZURE_WEBAPP_NAME }}
The first command will create an Azure Resource Group, where all the resources will be created. The second one will deploy the website using an Azure Resource Manager (ARM) template. The --template-file deployment/azuredepoy.json tells us the template is a file named azuredeploy.json located in the folder deployment. Notice that the application name is passed to a parameter myWebAppName, using the environment variable.
An ARM template is simply a flat file that a lot like a JSON document. Use can use any text editor, I like doing mine with Visual Studio Code and two extensions: Azure Resource Manager Snippets, and Azure Resource Manager (ARM) Tools With those tools I can build ARM template very efficiently. For this template, we need a service plane and a web App. Here what the template looks like.
This template is simple, it only contains the two required resources: a service plan, and a web app. To learn more about the ARM Template you can read my other post or check out this excellent introduction in the documentation.
Once the template is created and saved in its folder.
The deployment
There are only two last steps to the YAML file: the deployment and logout. Let's have a quick look at the deployment.
Now that we are sure the resources exist in Azure we can deploy the code. This will be done with azure/webapps-deploy@v1 that will take the package generated by dotnet into myapp. Since we are already authenticated there is no need to specify anything at this point.
Everything is ready for the deployment. You just need to commit and push (into master) and the GitHub Action will be triggered. You can follow the deployment by going into the Actions tab.
After a few minutes, the website should be available in Azure. This post only shows a very simple build and deployment, but you can do so many things with those GitHub Actions, like executing tasks or packaging a container... I would love to know how you use them. Leave a comment or reach out on social media.
Can I Have My CPU Back Visual Studio? (Rion Williams) - This is an interesting and easy solution to an annoying problem. Hopefully, a fix is coming soon.
Getting Started with YAML in Node.js using js-yaml (Dave Johnson) - Interesting post, I've been using YAML for few years now. However, it's true that when I did some work with Node.js I switched to json... Next time then...
New book: Begin to Code with C# (Kim Spilker) - C# is a very popular and powerful language, I'm happy to see new books to bring more people aboard.
Introducing docs.microsoft.com - Great post that explains all the nice features of the first glimpse of the new Microsoft documentation. They did a fantastic work, a post to read; a site to remember.
Cloud
Why Service Fabric? - You heard about the buzz word your tech guys are exited, but you would like to know why service fabric could be good for your business? This post is for you.
An application revolution powered by the cloud (Mark Russinovich) - This post is a great introduction to the air of micro-services. It explains the evolution from the monolithic architecture and introduces some container system.
Azure Active Directory Application (Vincent-Philippe Lauzon) - This post is a good intro to Azure Active Directory and how it could help us in our cloud applications.
Why Microsoft Azure? - Interesting post that explains major reasons why Microsoft is a lead in cloud computing.
C# Tips By Jason Roberts Publisher: Leanpub Released: December 2014
This book it undoubtedly for people who already know C#. If you want to learn C# by doing the best practices, I would strongly suggest to start with something else. However, if you already know how to code, and you want to improve your, or got this little plus; this book is a must.
It’s not a very big book, but all the zones are covered. It’s split into three parts. The first one will provides many good this to improve the performance of your code, customizes your debug experience, and more. The second part will focus on the very useful design patterns that we should all have in our back pocket. Finally, the third and last section introduces tools and frameworks (NUnits, Moq, etc.) to facilitate your work.
I would definitely recommend this book to any developer. The book is available in all the digital format for free, but if you like it consider giving a donation. :)
Miscellaneous
Finding an Invisible NAS on a Network (Alexandre Brisebois) - I like those stories where people, like us, learn something the “hard way” , and share their fresh experience.
Why you need to use Bower - If you are hesitating about if you should or not try Bower, this post will pin down the nail.
Image Sprites made easy with Web Essentials (Josh Eastburn) - If you thought that using sprite was too complicated for the benefit you could have, this post will show you how effortless it is today.
New Compiler and Moving to GitHub - Interesting improvement about the compiler, looking forward to try those new features... And time to add GitHub followed projects to add Typescript.
Get Better Acquainted with Azure (Mark BrownMS) - Wow! All kinds of resources are coved here. A post to read to find your next book or blog to subscribe.
Migrating Database Workloads to the Cloud - Great source of information. This article describes all the scenarios with the pros and cons then helps you in the steps to do it.
Channel 9 has an excellent streaming video that covers Code Maps here
Databases
re: Why You Should Never Use MongoDB (Ayende Rahien) - NoSQL is very popular, but we should learn and do our homework before starting a big project, like this post shows us.
WCF Worker Role Just Recycles on Windows Azure (Angshuman Nayak) - I really like this kind of post where the author shares with us how he investigated and found the solution for a problem.
How Do You Learn a New Framework? - Good post that introduces simplewebdev: a website that regroups information, blogs, articles about MVC pattern.
How to become a better GIT - Very interesting post that provides details informations to pick your site and client, and explains how to act as a good Git contributor.
Is OneNote the best ever App for Tablets? (Stu4rt) - I started using OneNote last year, and I never stop. It is a great application that works really smoothly on all devises.
SQL Azure: Automated Database Export (Tara Shankar Jana) - Nice post that details all you need to know about the new Sql Azure Automated export: options, cost, etc.
**Service Bus Error: The maximum entity size has been reached or exceeded for Topic (Ravi Verma) - Quick fix for a common error message. Be aware of the Default life time value.
Meter and Autoscale Multi-Tenant Applications in Windows Azure (Bruno Terkaly, Ricardo Villalobos) - Great articles that explains how to setup diagnostics to be able to autoscale in a multi-tenant context. The article also refers different resources for more details and tools.
Just released: MvcSiteMapProvider 4.0 (Maarten Balliauw) - Sitemaps is a great tool, learn more about it and how easy it is to add why in your project.
Windows Azure PowerShell June 2013 Update for IaaS and PaaS (Michael Washam) - With new Azure capabilities comes great PowerShell functionality... this post is all about that. Also Michal Washam is announcing that he is quitting Microsoft.
Azure VM Access Control with PowerShell (Tyler Doerksen) - Great with this post we now know all the new features that came up last week: powershell cmommand.
Making Computer Science Cool (Jonathan Rozenblit) - Really good resources post that gives place to get started based on our level of confort. It could also be use at home for our kids... I wonder if this kind of information is also available in other languages...
Just released - Microsoft Enterprise Library 6 (Grigori Melnik) - Nice update. If you don't know Enterprise Library (EntLib) it time to jump in! And for Azure developers check out the integration pack! It's a must.
Git Explained: For Beginners- If you don't know Git, or you still not familiar with it? This is definitely the post for you. From vocabulary to code sample this tutorial explains all you need to knows.
8 Risks When You Ignore Social Media (Hollis Thomases) - Social media for business is an interesting discussion topic, but this article brings something that sure: ignoring is not a good solution.