Showing posts with label ALM. Show all posts
Showing posts with label ALM. Show all posts

Wednesday, October 25, 2017

Helping (other) Student’s exchange France-Ukraine on ALM-VSTS-Azure

In 2016, I got asked to present Best Practices on ALM/DevOps with Azure to a Ukrainian university.
This year, from Poland/Warsaw I gave another talk via Skype to 18 students for over an 90 minutes.

Because the Ukrainian students are also studying French, I had to give the talk entirely in French, which was easy as it is my native tong !


https://twitter.com/LeontievIhor/status/923235782801936384

image

The slides are available here :

https://1drv.ms/b/s!AvT9OZrSFxhZxHD4vZ2LVqxP5fnf

image_thumb[2]

Tuesday, November 29, 2016

Helping Student’s exchange France-Ukraine on ALM-VSTS-Azure


A Ukrainian university asked me to provide a talk on Best Practices on ALM with Azure.
Since I could not travel at that time, I gave a talk via Skype to 20 students during one hour (45 min + questions).

Because the Ukrainian students are also studying French, I had to give the talk entirely in French, which was easy as it is my native tong !


The slides are available here :

https://1drv.ms/b/s!AvT9OZrSFxhZxHD4vZ2LVqxP5fnf

image

Monday, June 15, 2015

Azure Resource Group Templates: Use Github quickstart template [Part 2]

 

[Part 1] : Azure Resource Group Templates: Infrastructure as a Code
[Part 2] : Azure Resource Group Templates: Use Github quickstart template (this Post!)

This tutorial is based on the Github quickstart templates: https://github.com/Azure/azure-quickstart-templates

Let choose a template to provision an AD, that looks easy, but when manually configured, it takes hours (and days if you have to re-do it you are missing a step)

image

Open the project, and click the “Deploy to Azure” button

image

This button calls the URL: https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Factive-directory-new-domain%2Fazuredeploy.json

It will open a new Browser in portal.azure.com and a blade will present the “Edit Template” mode (similar to Visual Studio in ‘Part 1’), where you could add for instance more VM Size (by default, only ‘Standard’ VP Type, i.e. too expensive for my needs).

image

You could add a ‘small’ entry (deprecated) if you wish PROVIDED YOU DO NOT NEED Loadbalancing, else if the template needs Loadbalancing, because the VM-Small does not support it, the deployment will crash.

(note the source code of the page is quite funny “Want to build awesome web applications like this one? Join us.”)

image  image

 

Within minutes, you will already have a complete configuration, while the remaining VM are provisionned (i.e. no green check yet).

image

Azure Resource Group Templates: Infrastructure as a Code [Part 1]

 

[Part 1] : Azure Resource Group Templates: Infrastructure as a Code (this Post!)
[Part 2] : Azure Resource Group Templates: Use Github quickstart template

Summary:

  • Part 1 uses the template that comes along with Powershell command lines. The chosen template is sharepoint that is used as a ground for orther variant configuration. You will be able to fully customize it and archive it as “Infrastructure As A Code”
  • Part 2 uses a template present in https://github.com/Azure/azure-quickstart-templates that has a button that redirects you to https://portal.azure.com with the template ‘instanciated’ for you. You just need to provide few parameters.

First get the latest version of Azure Powershell using Microsoft Web Platform Installer:

image
image

Note: for extra security, you have to sign in befor being able to use the various cmdLets of the Azure Service Management.
It will open a Web Browser Login page. The Powershell CmdLets to get this login is given in the error message below.
image

 

Get the Configuration Manager CommandLets

PS C:\> Switch-AzureMode -Name AzureServiceManagement
(source: https://msdn.microsoft.com/en-us/library/dn654592.aspx)

Then, among the 800 templates and over! pickup the one you are interrested in (to be handy for reading, I exported this list huge into a Word processing document). (source : https://msdn.microsoft.com/fr-fr/library/dn654596.aspx) 

image

Now pickup and download the template (or templates) that you are interrested in (type-in the exact same name). In our case, ‘Microsoft.SharePointFarm.0.2.31-preview’image

i.e.

PS C:\> Save-AzureResourceGroupGalleryTemplate -Identity Microsoft.SharePointFarm.0.2.31-preview c:\tmpVince

This will download a single *.JSON file.
Alternatively, you can get them from here : https://github.com/ciphertxt/AzureRM-SharePoint-Templates

 

In VS 2015 RC (at least), create a new project of type “Azure Reource Group”
image

Pick up any template you wish. Below is an example of “Web app + SQL” template.

image

To better understant the power of Azure Resource Manager, lets start with a blank template that will let you start with a minimum of files (i.e. not fully blank!)
image

Select the template JSON file, then in the outline window, click the “Add” icon. Add the ingredients you like (below Application Insights for Web Apps is illustrated for the sake of the example. Not needed in our Sharepoint example).
image image

 

For the Sharepoint server, just add our recently downloaded *.JSON files
image

The new VS2015 RC editor helps you visualize the various parameters and resources
image

Once happy with your configuration, as any VS project, in order to deploy, one would … right-click and “deploy”:
image

Then, fill in the parameters (either here or later VS will popup you windows), and hit ‘Deploy’ !

image => image

Wait for few minutes, and watch out for the Output Window.

If anything goes wrong, you will be notified, such as below:

“
01:26:38 - Build started.
01:26:38 - Project "Sharepoint.deployproj" (StageArtifacts target(s)):
01:26:38 - Project "Sharepoint.deployproj" (ContentFilesProjectOutputGroup target(s)):
01:26:38 - Done building project "Sharepoint.deployproj".
01:26:38 - Done building project "Sharepoint.deployproj".
01:26:38 - Build succeeded.
01:26:39 - The following parameter values will be used for this deployment:
01:26:39 -     newStorageAccountName: vizpocfullnestoacc
01:26:39 -     newDomainName: viseopoc.onmicrosoft.com
01:26:39 -     newVirtualNetworkName: viseopocfullvnet
01:26:39 -     vnetAddressSpace:
01:26:39 -     hostName: vizpochostn
01:26:39 -     userName: vincethavo
01:26:39 -     password: <securestring>
01:26:39 -     location: North Europe
01:26:39 -     hardwareSize: A1
01:26:39 - Launching deployment PowerShell script with the following command:
01:26:39 - 'c:\wks\azureresourcegrp\webandsql\Scripts\Deploy-AzureResourceGroup.ps1' -StorageAccountName '' -ResourceGroupName 'viseopoc-noeu-resourcegrp' -ResourceGroupLocation 'northeurope' -TemplateFile 'c:\wks\azureresourcegrp\webandsql\templates\microsoft.sharepointserver2013trial.0.2.80-preview.json' -TemplateParametersFile 'c:\wks\azureresourcegrp\webandsql\templates\microsoft.sharepointserver2013trial.0.2.80-preview.param.dev.json'
01:26:39 -
01:26:39 -
01:26:39 - Accounts            : {[viseopoc@outlook.com, Microsoft.Azure.Common.Authentication.Models.AzureAccount]}
01:26:39 - Subscriptions       : {[364f617a-9521-4356-9d3c-66751f255f41, Microsoft.Azure.Common.Authentication.Models.AzureSubscription]}
01:26:39 - DefaultSubscription : Microsoft.Azure.Common.Authentication.Models.AzureSubscription
01:26:39 - Environments        : {[AzureCloud, Microsoft.Azure.Common.Authentication.Models.AzureEnvironment], [AzureChinaCloud, Microsoft.Azure.Common.Authentication.Models.AzureEnvironment]}
01:26:39 - Context             : Microsoft.Azure.Common.Authentication.Models.AzureContext
01:26:39 - ProfileLoadErrors   :
01:26:39 - ProfilePath         :
01:26:39 -
01:26:39 - cmdlet New-AzureResourceGroup at command pipeline position 1
Supply values for the following parameters:
01:26:39 - locationFromTemplate: 01:26:46 - northeurope
01:26:54 - [VERBOSE] 1:26:54 AM - Created resource group 'viseopoc-noeu-resourcegrp' in location 'northeurope'
01:26:55 - [ERROR] New-AzureResourceGroup : Error 1: Code=InvalidDeployment; Message=The deployment parameter 'vnetAddressSpace' is not valid.
01:26:55 - [ERROR]
01:26:55 - [ERROR] At C:\wks\azureresourcegrp\webandsql\Scripts\Deploy-AzureResourceGroup.ps1:89 char:1
01:26:55 - [ERROR] + New-AzureResourceGroup -Name $ResourceGroupName `
01:26:55 - [ERROR] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
01:26:55 - [ERROR]     + CategoryInfo          : CloseError: (:) [New-AzureResourceGroup], ArgumentException
01:26:55 - [ERROR]     + FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.NewAzureResourceGroupCommand
01:26:55 - [ERROR] 
01:26:55 -
01:26:55 -
01:26:55 -
01:26:55 - Successfully deployed template 'c:\wks\azureresourcegrp\webandsql\templates\microsoft.sharepointserver2013trial.0.2.80-preview.json' to resource group 'viseopoc-noeu-resourcegrp'.

”

Once fixed, check that that the deployment was completed properly, by opening the Azure Resource Group ‘viseopoc-noeu-resourcegrp’

image

 

REFERENCES:

Open source Samples of templates https://github.com/Azure/azure-quickstart-templates
Azure Resource Management presentation https://mix.office.com/watch/1ssggs9jqdd72

Friday, February 27, 2015

More Azure in the TFS vNext (2015) and no more WF in Builds Alleluia !

 

Remember my good old posts back in 2010, claiming that Batch scripts offers a great ROI :

Now, in 2015, guess what ?? Yes, Scripts are back !!
I was so pleased when installing TFS 2015 (CTP) where Builds were identified as “legacy” !! and yet also anxious, since it means throwing away a large amount of previous knowledge !

 

LIST OF NEW TFS 2015 FEATURES:

  • Assign multiple testers
  • Team Build preview
  • REST APIs
  • Service hooks
  • Sprint backlog and task board updates
  • Text filtering on backlogs & queries
  • Re-ordering in a filtered backlog
  • Edit on the Kanban board
  • Identity control and avatars
  • History control
  • View history on a folder
  • Improved merge performance
  • Query progressive disclosure

 

Here is the TFS 2015 CTP install process:

image

Once installed the documentation clearly scores out the “BUILD” tab and highlights the BUILD.VNEXT one:

image

image

Now the (new vNext) build are configured via the Web portal

image

and for those like me how hated to install previous version of VS with add-on “just” to Clone a build definition, here is the new ‘magic’ button :

image

Now that TFS is installed (and you could still install and configure the legacy Build at the same time), let the fun starts :

  1. Choose the create a new build definition, and you’ll be presented the choice of building a VS or a Xcode
    image
  2. Let us consider a VS build, and you’ll have by default two Build steps: VS (building *.sln) and a VS Test (building test*.dll)
    image
  3. Now you could add a large amount of Build Steps, particularly spacial ones for Microsoft Azure
    (and I expect some much more in an Open Source manner)image
  4. Now re-order the Steps as you wish. No more complex parallel crazy workflows that spans across multiple pages that crashed my Visual Studio, yet having a powerful configuration. 
    image






    ==>
    BECOMES AFTER
    RE-ORDERING
    ==>

    image
     
  5. No more multiple pop-ups (like the old ones). Everything is accessible rapidly.
    image
  6. To configure the Agent with infinite extensible capabilities !
    image
  7. Even more extensibility with the new Service Hooks, that interract with Azure Service Bus, Azure Storage, … and JENKINS, Trello, etc…
    image
  8. Here is a Zoom on the two Azure Hook capabilities
    image

 

HOW TO USE THE SERVICE HOOKS ??

  1. For instance, when a TFS event raises (exhaustively : Build Completed, Code pushed, Pull request created, Pull request updated, Team room message posted, Work item commented on, Work item created, Work item updated).
  2. Say, choose “Build Completed”. Now, whenever a build is completed, the action below will be triggered :

    image

 

Other support for Microsoft Azure:

Ability to add a deployment environment.
image
 

Here is the exhaustive list of what’s new in TFS 2015 : https://www.visualstudio.com/en-us/news/tfs2015-vs

Monday, August 4, 2014

Leaveraging BDD with Microsoft Azure and Visual Studio Online

 

BDD (Behavior Development Driven) and TDD are topics that are not new (my first post was in 2011).

Now that we have VSO, Visual Studio Online and Microsoft Azure, we can be even more Agile !

Without debating weather or not one should use BDD or TDD, this post focuses on how to do it the BDD way, and show that SpecFlow could handle easily French.

   

OBJECTIVE: From a “regular” specification (waterfall way) we are going to:

  1. Convert it into BDD,
  2. Write it down into Microsoft TFS / VSO, via Excel
  3. Implementer the Unit tests (helped by the BDD auto-generated code),
  4. The Dev is naturally going to ask questions to the PO (Product Owner) and one of the aim of BDD is to force them to talk ! and have a common language without having any misleading specification.
  5. Implements the code
  6. Performing Refactoring
  7. Prove the PO that the « Definition Of Done » based on the « Given-When-Then » of the BDD is compliant
  8. Il our case, I chose to implement with a 100%Code Coverage, since this is a sensitive and critical functionality
  9. With 100% of Code Coverage, even a slightest modification of the specs will be detected by the test harnesses and the Build machine.

Here is the “regular” Specification

Screen

Role

Profile

Visiteur

Manager

Utilisateur central

Admin

Ecran d 'accueil

Navigation

x

x

x

x

Activité prévisionnelle

Lecture

x

x

x

x

Saisie

x

x

x

Export csv

x

x

x

x

Performance

Lecture

x

x

x

x

Import & Export

Lecture

 

x

x

Lancement import

x

x

Lancement export

x

Utilisateurs

Lecture

x

x

x

Création / Modification

 

x

Paramètres

Lecture

x

x

Saisie alertes

x

x

Saisie paramètres généraux

x

Saisie paramètres généraux

x

 

STEP 1: Convert this table into BDD (In Order To – As a – I want ; and Given-When-Then)
as well as other Product Backlog Items directly into EXCEL (with a 2-way connection to Microsoft TFS / VSO)

If you are irritated with EXCEL, just use MS Project, Word or the TFS Web portal (below).

STEP 2: Let focus on one specific PBI
(displayed with IntelliSense within Visual Studio with the SpecFlow Add-on. Hence, one cannot write any specification since it is going to be compiled by MS Build or Visual Studio)

ETAPE 3: Let SpecFlow autogenerate the test harnesses from the BDD specification

According the the methodology « Red, Green, Refactor » (the you MUST ALWAYS follow in this order else you’ll end-up having tests that returns always True or you’ll forget to « refactor », …),

  1. I write the tests within the BDD auto-generated test hanesses. I run the tests that should fail (Red) {which is normal since I don’t have any code yet !}.
  2. I start implementing my 1rst code so that the tests becomes Green (with refactoring yet, so that if it’s wrong… you should fail fast)
  3. Once green, it’s time to Refactor which is great, since my code is so ugly that TFS refuses to archive my code.

 

BENEFIT N°1 : Refactoring

The refactoring forces me to have few iterations :

-          with ugly code: Maintainability Index = 20 and cyclomatic complexity = 105  (i.e. so complex that no one will want to maintain my code!! where one would say “Yes, but you know, this is a very complex use case, and I had to code 106 line of code! Which is obviously a bad excuse to produce bad code)

-          with less ugly code (Maintenability Index = 59 ; cyclomatic complexity = 63)

-          with maintainable code that fits into half-a-screen (Maintenability Index = 72 i.e. very maintainable; cyclomatic complexity = 28 i.e. not complex).
Rappel:  « Red, Green, Refactor » reminds me that my code can still be refactored to be even better… but at some point we have to deliver the code !

BENEFIT N°2 :

The code is centralized, which seams to be so obvious BUT the fact is that I can still find numerous projects with logic hardcoded into the GUI.

 

BENEFIT N°3 :

The code is protected by 100% of Code Coverage . i.e the slightest modification of the spec will be detected by VSO / TFS.

To cover the 100% of the needs, a hundred of tests are needed (since initially a hundred of line of code). They are wrapped up into only 2 BDD tests that represents 95+5 = 100 ms to execute automatically everytime a check-in is performed.
In the contrary, a “manual test” would have been boring to perform during hours.

image

The 100% of code coverage highlighted in blue ; even Throw Exceptions are tested to reach the 100%

BENEFIT N°4 : Everything is integrated to Visual Studio and Microsoft Team Foundation Server (TFS) or Visual Studio Online (VSO), with Continuous Deployment on Microsoft Azure

BENEFIT N°5: Have you ever read the specification ??

Now with BDD, the Spec becomes part of the « Definition Of Done » (DoD) and most importantly the specification are “bare bone” (i.e. you don’t write unnecessary text) and things that contradicts themselves are sometimes detected by the compiler.

That’s the end of the era where Product Owner would spend days and months to write specifications that are never read, or best are out of date and never synched with the code. Here the Word document is automatically generated by the Given-When-Then acceptance criteria.