Monday 1 February 2021

Power shell script to start, stop and restart windows services.

 With the help you below power shell script you check windows service's status and can restart, stop etc. even on remote servers.


 

[string]$computerName

 

## Create a log file

$LogFile = "E:\Logs\logs_"+(Get-Date).ToString('yyyy-MM-dd')+".txt"

## Count: 3

[string[]]$computerNames ="ServerName1", "ServerName2", "ServerName3"

try {

 #Function that logs a message to a text file

function LogWrite

{   param([string]$Message)

    ((Get-Date).ToString() + " - " + $Message) >> $LogFile;

}

Write-Host "Execution started"

LogWrite -Message "Execution started";

  ForEach ( $computerName in $computerNames ) {

    Write-Host "++++++++++++++++++++++++++++++++++++++++++++" -ForegroundColor Magenta

    try {

     #get a service to check current status

    $svc = get-service -Name "ServiceName" -computername $computerName

      #check if service’s current status is stopped if yes then start it

     if ( $svc.Status -eq "Stopped") {

          (Get-Service -Name "ServiceName" -Computername $computerName).Start();

           Write-Host $computerName -NoNewline

         Write-Host ": the service has started successfully"

         LogWrite -Message "$computerName : the service has started successfully"

         }

         else{

           Write-Host $computerName -NoNewline

           Write-Host ": the service is already up and running"

           LogWrite -Message "$computerName : the service is already up and running"

            }

     }  

        catch {

        LogWrite -Message "$computerName : service reset failed- $_"

        Write-Host ": service start failed"

        Write-Host "Error : $_"

         }

     }

 Write-Host "Execution finished"

 LogWrite -Message "Execution finished"    

 }

    catch {

        LogWrite -Message "$computerName : service reset failed- $_"

        Write-Host ": service start failed"

        Write-Host "Error : $_"

         }

 

 

Thursday 28 January 2021

Azure boards- a work items work flow with continuous integration (CI) an example.

 

 

1.1 Open a Defect/Bug

Create a work item type of Issue/Bug and assign to developer as shown in below screen shot.

 



 

1.2 Work Item Progress

Work items created can be seen in Work Items, Backlog or in Sprint under Boards section. Developer can start working on work items assigned to him/her by linking them to an existing branch or creating a new branch to get the latest source code from master branch.

Once the latest code pushed to developer’s branch, he/she can work in order to fix the bug, add new or modify existing code. On completion code can be reviewed by another person and approved. Once the changes reviewed and approved, then make it Complete which will merge and commit the latest change to master branch.


1.2.1 Create New Branch

Create a new branch from master to get the latest source code and start working on it in order to complete the assigned Work Item.


1.2.2 Deploy to Dev Stage

Developer can deploy the source code/configuration to a stage (Dev/Testing) where he/she can perform some tests to ensure that the defect has fixed and no new bug introduced. 

a.       To deploy your code/configuration to a stage where you want to test your code click on “Set up build”


b.      Choose app type under “configure you pipeline” and then azure subscription (Probably Collaudo subscription). In my case it is “Free Trial”.


c.       Select your app under azure subscription (if there is no app in that case, go to azure portal and create your app before setting up this build and deployment).

 

 

d.      Review you pipeline YAML file to ensure the correctness of your deployment and click on “Save and run” to start deployment.




e.      Deployment succeeded to Dev stage (below is result screen). Now a new version is available for testing.

 


1.2.3 Create a Pull Request

Once you tested you work in Dev stage then create a pull request to make you code available to be reviewed & approved by other team member in order to merge it with master branch.

 

1.2.4 Code/configuration Change, Review and Approval

Below screen shot shows, description about the code changes made and reviewed.

 


1.2.5 Merge your branch with Master

Post code reviewed and approved click on “complete” to open a page shown in below screen shot. Check the box as your choice and click on “complete merge”


1.3 Track Work Item History

Open a work item from azure boards to see development and deployment history. Click on the links to see details.

a.       Image 1



b.      Image 2



Wednesday 13 January 2021

DevOps Continuous Integration and Continuous Delivery


CI/CD is a method to frequently deliver apps to customers by introducing automation into the stages of app development. The main concepts attributed to CI/CD are continuous integration, continuous delivery, and continuous deployment. 

Below is the CI/CD work flow diagram.





Pipeline:

A pipeline in a Software Engineering team is a set of automated processes that allow Developers and DevOps professionals to reliably and efficiently compile, build and deploy their code to their production compute platforms.

1.       Build Pipeline

2.       Release Pipeline


Tuesday 12 January 2021

Simple Kusto Queries for beginners ?



1. Sample kusto query to extract last 24 hours logs.


AzureDiagnostics 
| where TimeGenerated > ago(24h)


2. Using below kusto query you can extract logs between any two datetimes. 

 AzureDiagnostics  
| where TimeGenerated between (datetime(2021-01-12 10:30:00) .. datetime(2021-01-12 11:30:00))



3. This is sample kusto query to search particular keywords on any column. Below query is to search all the records from Diagnostics table where backendUrl_s contains a giving string


AzureDiagnostics 
| where backendUrl_s contains "SomeString"


Monday 11 January 2021

Azure Boards and Repos Working Flow

You can quickly and easily start tracking user stories, backlog items, task, features, and bugs associated with your project. You track work by adding work items based on the process and work item types available to your project.



Sunday 10 January 2021

Scrum Process Flow Overview

 

Scrum is a framework for project management that emphasizes teamwork, accountability and iterative progress toward a well-defined goal. The framework begins with a simple premise: Start with what can be seen or known. After that, track the progress and tweak as necessary.






Product managers are strategic. They focus on the product’s vision, company objectives, and the market.

Product owners (which you’ll find typically in agile organizations) are more tactical. They translate the product manager’s strategy into actionable tasks, and work with cross-functional agile teams to make sure they are executing on those requirements.

A scrum master is the facilitator for an agile development team. Scrum is a methodology that allows a team to self-organize and make changes quickly, in accordance with agile principles. The scrum master manages the process for how information is exchanged.

        The responsibilities of a Scrum Master include:

 

Ø  Clearing obstacles

Ø  Establishing an environment where the team can be effective

Ø  Addressing team dynamics

Ø  Ensuring a good relationship between the team and product owner as well as others outside the team

Ø  Protecting the team from outside interruptions and distractions.