Every week, I publish my reading notes. Those are the articles, blog posts, podcast episodes, and books that catch my interest and that I found interesting. It's a mix of the actuality and what I was looking for.
ASP.NET Core updates in .NET Core 3.1 (Sourabh Shirhatti) - I'm very excited about this 3.1 version.I'm not sure why maybe it's because it is the long-time support (LTS). Nevertheless, I will update all my projects.
Use Google Sheets to translate faster (Robin Kretzschmar) - Woo! That's pretty cool. Automatic translation is never the best but this is very convenient.
7 Dangers of Micromanagement ( Jack Wallen) - Nice post to help you give the best version of yourself. (Note it's now 6, but it was 7 when I read it)
Every week, I publish my reading notes. Those are the articles, blog posts, podcast episodes, and books that catch my interest and that I found interesting. It's a mix of the actuality and what I was looking for.
Cloud
Azure Functions with QueueTriggers and .NET Core – Configuration and Troubleshooting (Jeff) - Poor Jeff, I was there on his stream and he struggles so much to understand what was happening. And honestly me too! Despite the fact that I know and use Azure Function regularly I completely missed the missing instruction... The good news is since the documentation is open-source we can improve it...
Programming
A quick overview of ASP.NET Core with Rider (Rachel Appel) - I never used Rider in a real project. However, the quality of this code IDE is not in question. It looks awesome and this post shows how it supports the latest version of .Net Core.
Visual Studio Extensions: 8 You Should Check Out (Carlos Schults) - A nice post that shares useful extensions for developers. I also like the fact that in the title it's 8 and in the url it's 7 LOL...
I'm still balanced about this book. It was a good book, even if I found some chapters that were too long. I also got lost by moments. I had the impression that some thoughts or ideas were not developed correctly and more quickly wrapped. In counterpart, some were very well served and clear.
Azure DevOps Roadmap update for 2019 Q4 (Gloridel Morales) - Since the multi-stage pipeline launch in May, the team as been listening to his community. In this post learn more about what they have been working on and what is their roadmap.
Code Comments (Donn Felker) - Very smart idea! I'm staring using that rule right away.
Microservices Fundamentals (Mark Heath) - New course on Pluralsight about an indeed challenging topic. This post shares the plan of that Microservices course.
Stop Waiting! Start using Async and Await! (Simon Hawe) - Learn the power of async in this excellent post. The example may be in Python the idea is the same however language we are using.
What’s in my bag for Microsoft Ignite 2019 (Thomas Maurer) - As I'm packing my own bag, going to Ignite for the first time it's interesting to see what others bring... (Note to myself next time don't leave at home your network cable adapter)
I really like this book, and planning to read it again soon. I like the way things are simply explained. Like if you deconstructed a situation and then re-building it. It felt authentic and true. It's nothing transcending, but the way it is explained is great.
Andrew Connell's Blog (Andrew Connell) - This nice post is the second of a series of three. It explains how to do every step but also why the author decided to do that.
Highlights from Git 2.23 ( Taylor Blau) - This was the first time I notice an update of git... It is very intriguing to see such a powerful tool evolving and see some experimental feature. It's a long post, but totally worth it.
Docker from the beginning — part III (Chris Noring) - Third of this docker series. I like how it is not only a happy path but the learning path with the fails and victories.
Extreme Ownership: How U.S. Navy SEALs Lead and Win (Jocko Willink, Leif Babin) - Very interesting book. Yes, it contains a lot of battle details, and first I was not sure, but then things "fall" all in place when you understand what the story was "demonstrating." It also contains more business focus examples. Everything is very clear, well explained in plain English.
For a project I just started, I need to create Azure resources from code. In fact, I want to create an Azure Container Instance. I already know how to create a container from Logic Apps and Azure CLI/PowerShell, but I was looking to create it inside an Azure Function. After a quick research online, I found the Azure Management Libraries for .NET (aka Fluent API) a project available on Github that do just that (and so much more)!
In this post, I will share with you how this library work and the result of my test.
The Goal
For this demo, I will create a .Net Core console application that creates an Azure Containter Instance (ACI). After it should be easy to take this code and migrate to an Azure Function or anywhere else.
The Console Application
Let's create a simple console application with the following command: dotnet new console -o AzFluentDemo cd AzFluentDemo dotnet add package microsoft.azure.management.fluent The last command will use the nuget package available online an add it to our solution. Now we need a service principal so our application could access the Azure subscription. A since way to create one is the use Azure CLI az ad sp create-for-rbac --sdk-auth > my.azureauth This will create an Active Directory (AD) Service Principal (SP) and write the content into the file my.azureauth. Perfect, now open the solution, for this kind of project, I like to use Visual Studio Code so code . will do the work for me. Replace the content of the Program.cs file by the following code.
using System;
using Microsoft.Azure.Management.Fluent;
using Microsoft.Azure.Management.ResourceManager.Fluent;
using Microsoft.Azure.Management.ResourceManager.Fluent.Core;
namespace AzFluentDemo
{
class Program
{
static void Main(string[] args)
{
string authFilePath = "/home/frank/Dev/AzFluentDemo/my.azureauth";
string resourceGroupName = "cloud5mins";
string containerGroupName = "frank-containers";
string containerImage = "microsoft/aci-helloworld";
// Set Context
IAzure azure = Azure.Authenticate(authFilePath).WithDefaultSubscription();
ISubscription sub;
sub = azure.GetCurrentSubscription();
Console.WriteLine($"Authenticated with subscription '{sub.DisplayName}' (ID: {sub.SubscriptionId})");
// Create ResoureGroup
azure.ResourceGroups.Define(resourceGroupName)
.WithRegion(Region.USEast)
.Create();
// Create Container instance
IResourceGroup resGroup = azure.ResourceGroups.GetByName(resourceGroupName);
Region azureRegion = resGroup.Region;
// Create the container group
var containerGroup = azure.ContainerGroups.Define(containerGroupName)
.WithRegion(azureRegion)
.WithExistingResourceGroup(resourceGroupName)
.WithLinux()
.WithPublicImageRegistryOnly()
.WithoutVolume()
.DefineContainerInstance(containerGroupName + "-1")
.WithImage(containerImage)
.WithExternalTcpPort(80)
.WithCpuCoreCount(1.0)
.WithMemorySizeInGB(1)
.Attach()
.WithDnsPrefix(containerGroupName)
.Create();
Console.WriteLine($"Soon Available at http://{containerGroup.Fqdn}");
}
}
}
In the first row, I declare a few constants. The path of the service principal created earlier, resource group name, the container group name, and the image I will use. For this demo aci-helloworld. Then we get access with the Azure.Authenticate. Once we got access, it's y easy and the intellisense is fantastic! I don't think I need to explain the rest of the code as it already self-explanatory.
Got an Error?
While running you main in contour an error message complaining about the namespace not being registered or something like that ( I'm sorry I did not note the error message). You only need to register it with the command:
az provider register --namespace Microsoft.ContainerInstance
It will take a few minutes. To see if it's done you can execute this command:
az provider show -n Microsoft.ContainerInstance --query "registrationState"
Wrap it up
And voila! If you do a dotnet run after a minute or two, you will have a new web application running inside a container available from http://frank=containers.eastus.azurecontainer.io. It's now very easy to take that code and bring it to an Azure Function or in any .Net Core Application that runs anywhere (Linux, Windows, Mac Os, web, containers, etc.)!
Azure Portal October update (Peri Rocha) - I'm sure you noticed... The portal is always evolving getting better every day. This post list all the changes, what have you missed?
Introducing Azure Functions 2.0 (Eduardo Laureano) - Wow, the Azure Functions has evolved so much since the beginning. It's time to upgrade our old functions.
Microsoft Ignite Aftermath ( Chris Pietschmann, Dan Patrick) - If you are like me and need to catch up on what append to Ignite, this post is a really good place to start as it contains a list of all the links we need.
Securing Web Applications - Simple Talk (Vishwas Parameshwarappa) - Security should be in our priority in this time of APIs and IoT.... Excellent post to get started with multiple security breaches and how to fix them.
Tuples In C# (Mahesh Chand) - Tuples are one feature introduced in .Net 4.0 that can simplify our life a lot. Learn how in this post.
Windows Insider Program.next() (Dona Sarkar) - The Windows 10 anniversary edition is out since August 2nd. This post is about the community who made that possible, and explains how you could join.
IaaS isn’t your only path to outsized gains (James Staten) - Excellent post full of true and interesting facts that, at a very high level, explains the real power of the cloud.
Release notes (Matt Farmer) - Easier than ever, no more need to dig to know what new in each release. Read what the Api Management team has cooked for us.
Exploring dotnet new with .NET Core (Scott Hanselman) - I discover the different types in dotnet new command during Julie Lerman's talk at DevTeach and now this post shows a list of incredible opportunities.
Exploring the new .NET (Scott Hanselman) - This is the first post I read about the "dotnet compile" since the MVP Summit, and it looks at as much interesting as before.
Why build scripts? (Amir Barylko) - This post changed my mind about F#, now I'm looking forward to try it.
Visual Studio Shortcuts: Format Document (Jeremy) - Recently, I have been surprised to learn that some people are still not aware of that very powerful feature o VisualStudio.
Announcing Programmer Tools! (Henry Spencer) - We all need some little tools from time to time. This post lists many useful tools, and what's nice about them is that they are available from everywhere because they are online tools.
Today, I was running around with my laptop trying to find someone to show him what I did. My problem was that since I'm working from home, I found no one except my dog... Toby, did you see what I just did! He was looking at me and didn't really care about that I was doing some C# in Atom, a regular text editor. So, here I am now, sharing my discovery with you.
The "What"
While reading some article on the Internet, I fall on a video talking about OmniSharp.
A family of Open Source projects, each with one goal - To enable great .NET development in YOUR editor of choice.
SO I decide to give it a try in one of my favorite text editors this time called Atom.
Less than two minutes after, I was running across my house....
The "How"
What I like about Atom that it is so easy to install and to customize. The easiest way to install it is via Chocolatey.
Chocolatey NuGet is a Machine Package Manager, somewhat like apt-get, but built with Windows in mind.
Assuming that you don't have Chocolatey installed, let's start by that. Open a command prompt (cmd.exe) as Administrator, and execute this command:
In a new command prompt again with the administrator permission, let's Install the text editor Atom:
cinst Atom
and Git:
cinst Git
Now to install the OmniSharp in Atom you have two options. You could do it through the Settings or using a console. For this post, I will use the second option. Let's open a new command prompt, always as Administrator.
The reason why I use a new prompt every time is to be sure that environment variable gets refreshed.
using System;
namespace ConsoleAppDemo
{
class Program
{
static void Main(string[] args)
{
var myBook = new Book{Title="Get Started with OmniSharp"};
Console.WriteLine(String.Format("Here is my review of: {0}", myBook.Title));
}
}
public class Book
{
private string _review;
public string Title{get;set;}
public string Review{
get{
if(String.IsNullOrEmpty(_review))
{
_review = "This book is nice";
}
return _review;
}
set{
_review = value;
}
}
}
}
Nothing special until you start the OmniSharp server with Ctrl-Alt-o.
Boom!
As you can see now the intelisense, completion, code navigation and so more! If you click on the little green flame on the bottom left you see details about notification and error message.
The end
OmniSharp is a frontend compiler, not a complete compiler so it doesn't generate CLI code. But It's already a lot. Today, you can use OmniSharp with Sublime Text 3, Atom, Emacs, Brackets, Vim and with command line only. So whether on your old laptop or your new PC, whether you run Linux, Mac or Windows let's do some C#!