Reading Notes #365

Cloud


Miscellaneous


Books


I Hope I Screw This Up: How Falling In Love with Your Fears Can Change the World (Kyle Cease)

I was definitely not expecting that, when I picked up this book, but I am happy I did.

This "self-help" book is filled with a ton of comedy and I appreciated it. I felt like my best friend was talking about a serious topic but because he was in a crazy good mood was just having a good time telling me his story. Simple and real. It leaves you with a lot to think about.





Reading Notes #364

Cloud




    Programming



    Miscellaneous




    ~

      Reading Notes #363


      Cloud




      Programming




      Databases




      Miscellaneous


      ~


      Reading Notes #362



      raquetteSuggestion of the week



      Cloud



      Programming



      Miscellaneous



      ~

      Reading Notes #361

      MVIMG_20190110_075409_2Cloud



      Programming



      Miscellaneous



      Books

      ted-talk


      TED Talks: The Official TED Guide to Public Speaking

      Author: Chris J. Anderson

      Fantastic book that covers a lot of topics related to presenting. It covers the before, during, and even the after very smartly. There are no recipes here and this is exactly what makes this book so great. A must.











      ~


      Reading Notes #360

      insta-IMG_20181225_135719

      Cloud



      Programming


      Miscellaneous


      ~


      Reading Notes #359

      DockerDesktopCloud


      Programming


      Databases


      Miscellaneous


      Books

      How to Be a Bawse_cover
      How to Be a Bawse A Guide to Conquering Life
      Lilly Singh
      Not only the message is strong, but the way she delivers it is awesome. Many times I laugh and nod of the head... Definitely a great book to read at the end of the year when resolution time is not far...









      ~

      Reading Notes #358

      CakeLogoCloud


      Programming


      Miscellaneous


      ~

      Reading Notes #357

      71lKlEYntPL._SL1500_Suggestion of the week


      Cloud


      Programming


      Miscellaneous



      ~


      Reading Notes #356

      IMG_20181128_122246Suggestion of the week

      • Security Headers (Tanya Janca) - Interesting post that shows the code/configuration we need to add, in order to get a more secure website.

      Cloud


      Programming


      Miscellaneous


      Books

      fast_focus_coverFast Focus: A Quick-Start Guide To Mastering Your Attention, Ignoring Distractions, And Getting More Done In Less Time! (Damon Zahariades) - Great book well organized. Simple strike to the point. It is divided into three parts: understanding focus, creating an environment for focus, and employing tactics to focus. It lists the top 10 obstacles to staying focused and gives you a great idea on how to get start your journey.











      ~


      Reading Notes #354

      Cloud


      Programming


      Books

      Extreme Ownership_coverExtreme 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.









      ~

      Reading Notes #353

      aliasesSuggestion of the week



      Cloud



      Programming



      Books

      The_FIrst_20_HoursThe First 20 Hours: How to Learn Anything...Fast (Josh Kaufman) - That was a very interesting book. I devoured it much faster than I thought! As I was reading it, I was thinking... hey as a developer/programmer I already do a lot of those things... Things change so fast, technology changes... And a few pages later, the author was saying the same thing. :) It looks like we can adapt to many deferent situations. The author share with us a few journeys as he was learning new stuff. While I may not be interested to learn how to play to Go, I found all part of the book very interesting as those journeys a pact with tons of information.
      ISBN: 1591845556 (ISBN13: 9781591845553)


      Miscellaneous


      ~

      Reading Notes #352

      Suggestion of the week


      Cloud


      Programming


      Data


      Miscellaneous


      Books

      • The Personal MBA: Master the Art of Business (Josh Kaufman) - An interesting book that helps to get in the mood, get prepared, and maybe for some whom weren't sure yet about the idea of a personal MBA (compare to the regular one)... Help to start planning and get moving. This book isn't an one book miracle MBA certification, but most likely a really good way to understand the journey the reader is about to start. The complete list of books to achieve this adventure is constantly updated and is available online. 


      ~

      How to create an Azure Container Instance (ACI) with .Net Core

      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.

      hello-container

      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.)!


      In a video, please!


      I also have a video of this post if you prefer.



      References




      ~

      Reading Notes #351

      MVIMG_20181111_190706

      Cloud


      Programming


      Data


      ~


      Reading Notes #350



      markdig

      Cloud


      Programming


      Miscellaneous


      Books

      Fast FocusFast Focus (Damon Zahariades) - Great short book. Not like the other of his kind, this book goes right to the point and offers actionable item. It's very practical and accessible to everyone. At the end of the book, you know what to do to get started and improve your focus.



      Let’s create a continuous integration and continuous deployment (CI-CD) with Azure DevOps

      I'm about to start a new project and want to have it with a continuous integration (CI) and continuous deployment (CD). I've been using VSTS for a while now but didn't have the chance to try the new pipelines. If you didn't know VSTS as been rebranded/ redefined as Azure Devops. Before going in with the real thing I decided to give it a try with a simple project. This post is to relay those first steps.

      Get Started


      Let's start by creating our Azure Devops project. Navigate to Dev.Azure.com and if you don't already have an account create one it's free! Once you are logged-in, create a new project by clicking the New project blue button in the top right corner.

      createNewProject

      You will need to provide a unique name and a few simple information.

      The Application


      First thing first, we need an application. For this post, I will be using a simple Asp.Net Core site. For the repository, we have options. AzureDevOps (ADOps) support many repository: GitHub, Bitbucket, private Git and its own. Because the project I've created is public I decided to keep the code at the same place as everything else.

      From the left menu, select Repos. From here if the code already exist just add a remote repository, or clone the empty one on your local machine, the usual. Create and add your code to that repository.

      Repos

      The Azure WebApp


      The next step is to create a placeholder for our CD pipeline. We will create an empty shell of a web application in Azure with these three Azure CLI commands. You can execute them locally or from the Cloud Shell. (Don't forget to validate that you are in the good subscription)
      az group create --name simplegroup --location eastus
      
      az appservice plan create --name simpleplan --resource-group simplegroup --sku FREE
      
      az webapp create --name simplefrankweb --resource-group simplegroup --plan simpleplan
      
      The first command will create a Resource group. Then inside of this group we create a service plan, and finally we create a webapp to the mix.

      Continuous Integration


      The goal is to have the code to get to compile at every commit. From the left menubar, select Pipelines, and click the create new button. The first step is to identify where our code is, as you can see Azure DevOps is flexible and accept code from outside.

      NewPipeline_step1

      Select the exact repository.

      NewPipeline_step2

      This third step displays the YAML code that defines your pipeline. At this point, the file is not complete, but it's enough to build, we will come back to it later. Click the Add button to add the azure-pipelines.yml file at the root level of your repository.

      NewPipeline_step3

      The build pipeline is ready click the Run button to execute it for the first time. Now at every commit, the build will be triggered. To see the status of your build just on to into the build section from the left menubar.

      buildSuccess

      Continuous Deployment


      Great, our code gets to compile at every commit. It would be nice if the code could also be automatically deployed into our dev environment. To achieve that we need to create a Release Pipeline. And our pipeline will need artifacts. We will edit the azure-pipelines.yml to add two new tasks. You can do this directly in the online repository or just from your local machine; remember the file is at the root. Add these commands:

      - task: DotNetCoreCLI@2
        displayName: 'dotnet publish $(buildConfiguration)'
        inputs:
          command: publish
          publishWebProjects: True
          arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
          zipAfterPublish: True
      
      - task: PublishBuildArtifacts@1
        displayName: 'publish artifacts'
      

      Those two tasks are to publish our application (package it), and make it available in our Artifact folder. To learn more about the type of command available and see example have a look the excellent documentation at: https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core. Once you are done, save and commit (and push if it was local).

      From the left menubar, click on e the Pipeles, select Release, and clienk the New Release blue button. Select the template that matches your application. For this post Azure App Service deployment is the one we need.

      NewRelease_step1
      The next thing to will be to rename the environment for something else than Stage 1, I named mine "to Azure" but it could be dev, prod or anything that make sense for you. Click on the Add an Artifact button.

      ReleasePipeline

      You will now specify to the pipeline were to pick the artifacts it will deploy. In this case, we want the "output" of our latest build. And I renamed the Source alias as Drop.

      AddArtifact

      To get our continuous deployment (CD) we need to enable that trigger by clicking on the little lightning bolt and enabled it.

      TriggerRelease

      The last step to configure the Release pipeline is to specify a destination. By clicking on the "1 job, 1 task" in the middle of the screen (with the little red exclamation point in a circle), that will open the window where we will do that.

      Select the subscription you would like to use, and then click on the Authaurize button on the right. Once it's done go change the App Service Name. Click on it and wait 2-3 seconds you should see the app we created with our Azure CLI display. Select it, and voila!

      SetupReleaseDetails

      Now add a ReadMe.md file by checking out the code on your local machine or directly in Azure DevOps. Grab a badge from the build and/or release and copy paste it in the ReadMe. To get the code snippet of your badge, go to your build/ release definition, and click the ellipse button. Select Status badge and copy the snippet that matches your destination file (in our case the Markdown).

      GetaBadge_2

      Now when you go to the Overview page, you will have a nice badge that informed you. It also works on any web page just use the HTML snippet instead.

      simple_frank

      In a video, please!


      I also have a video of this post if you prefer.




      References:



      Reading Notes #349

      playWithDockerCloud


      Programming


      Miscellaneous


      ~ Enjoy!

      Reading Notes #348

      IMG_20181016_073145

      Cloud


      Programming


      Data


      Miscellaneous


      ~enjoy!

      Reading Notes #347

      MVIMG_20181011_103658

      Cloud


      Programming


      Data


      Miscellaneous



      Reading Notes #346

      Cloud

      IMG_20181006_093540 (1)

      Programming


      Miscellaneous

      • 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.

      ~

      Reading Notes #345

      DSCF1554Suggestion of the week



      Cloud



      Programming



      Miscellaneous

      ~

      How to Create Your Custom Artifacts for DevTest Labs

      Most of the time when we use an Azure Devtest Lab it to Test our own application. This means that will need to install them on the virtual machines, every time. To do that, we need to create a custom artifact and add it to our formulas or to our claimable VMs. Lucky for us, creating a custom artifact is much easier than you may think. In fact, this post I will show you how easy it can be.

      Goal

      I want to create an artifact available from a private repository (Git from dev.azure.com in this case) that will set the timezone inside the VM.

      Getting started

      First, let's use a section in the Azure portal that is very useful; the Get Started section. In the portal navigate to your DevTest Lab (1), and select the Getting Started option from the left menu bar (2). In this new bar scroll down to the Lear more area and select Sample artifacts and scripts (3).

      GetStarted
      That will open the DevTestLab artifacts, scripts and samples project from Azure on Github. Open the folder Artifact, to see the list of all the usual artifacts you find in the public repo that is available by default in the portal.

      Notice how all artifacts are in their own folder. When you create a new artifact, you can always come here and pick something similar to what you are trying to do. This way, you won't start from scratch. Let's open windows-vsts-download-and-run-script. An artifact is defined in the file Artifactfile.json. This file is mandatory and cannot be renamed. You can put scripts, images, or anything else you need inside this folder.

      Open the Artifactfile.json file and have a look.

      ArtifactfileSample
      As you can see it's a simple JSON file. In the section (A) you will define the title, description, publisher, OS and the Icon. Note that the Icon must be accessible publicly, it could be on github, a blob storage or on a website. Section (B) is to define all the parameters you may need to install your artifact on the VM. Finally In (C) it's the command to execute.

      Create the Artifact

      Here is the JSON for our windows-Set-TimeZone artifact. A made it very static by not passing any parameter, but in a reel situation, a timezone parameter would be better.
      Artifactfile.json
      {
          "$schema": "https://raw.githubusercontent.com/Azure/azure-devtestlab/master/schemas/2016-11-28/dtlArtifacts.json",
          "title": "Set TimeZone to Eastern Standard Time",
          "description": "Execute tzutil command on the VM set set the Time Zone",
          "publisher": "FBoucher",
          "tags": [
              "PowerShell"
          ],
          "iconUri": "https://raw.githubusercontent.com/Azure/azure-devtestlab/master/Artifacts/windows-run-powershell/powershell.png",
          "targetOsType": "Windows",
          "parameters": { },
          "runCommand": {
              "commandToExecute": "tzutil.exe /s \"Eastern Standard Time\""
          }
      }

      Create an artifact repository

      For this post, I'm using Git from Azure Devops (dev.azure.com) previously named VSTS, but any private repository should works. If it's not already done create a project and go to the Repos section. Create a root folder named Artifacts or something else if you prefer. Then add a new folder for your artifact. To follow the best practices you should start with the name of your artifact by the name of the targeted OS; in my case windows-Set-TimeZone. Now add the file Artifactfile.json defined previously.

      Note the url of the repository, it should be easy to get it by click on the Clone button that is on the top right of the screen.

      clone

      Add repository to DevTest Lab

      Now we need to add this repository to our Devtest Labs. From the portal.azure.com, open the blade of your lab. From the left panel, click on Repository, then click the Add button.

      CreateRepo
      It's time to use the information noted previously. This is about the Repository, not the artifact.

      Use the Artifact

      The only thing left is to use our artifact. You can find it while creating a VM or a formula. When you have parameters define in your Artifactfile.json, the parameters will be listed in a form completly a the left.
      artifactList
      And if you try it, you will see that the time match the desired timezone. Here my PC is set to display with a format of 24H put it's the same... yep I'm in Eastern Standard Time.

      voila

      Add it to an ARM template

      Doing it with the nice interface is good when you are learning. However, we all know that no DevOps will do that manually every time. So let's add our Repository to our ARM template. If you need more detail on the deployment method, I explain it in a previous post How to be efficient with our Azure Devtest Lab deployments.

      When you don't know the type or the structure of a resource, you can always go in the Resource Explorer (resources.azure.com) there will be able to find your resource and see how it's defined.

      ResourceExplorer
      So for this post our artifactsources will look like this:
      {
          "properties": {
              "displayName": "Cloud5mins",
              "uri": "https://fboucher.visualstudio.com/DefaultCollection/Cloud5minsArtifacts/_git/Cloud5minsArtifacts",
              "sourceType": "VsoGit",
              "folderPath": "/Artifacts",
              "armTemplateFolderPath": "",
              "branchRef": "master",
              "securityToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
              "status": "Enabled"
          }, 
          "name": "Cloud5minsRepo",
          "type": "Microsoft.DevTestLab/labs/artifactsources"
      }
      An artifactsources goes in the Resources list inside the Devtest Labs.

      ARM
      In an ARM template you have the main node Resources (A), then you will have the Lab node (B). Inside this node, you should see second resources list (C), where the Virtual Network is defined. The artifactsources should go there.

      Then when you declare your formula, you just need to reference this repository, exactly like the public one.

      In a video, please!

      I also have a video of this post if you prefer.



      Reference: