Install PowerShell Modules on hosted agent in VSTS (Visual Studio Team Services)

Visual Studio Team Services (VSTS) is popular tool of choice for various purposes where product is heavily dependent on Microsoft technologies like .NET, Azure, etc. It does lot of work such as Source code management, Building CI/CD pipelines, Package Management, Agile Issue tracking, etc. It is a cloud hosted service offering from Microsoft.

Hosted agent is a build agent that is provided by Microsoft for build and continuous integration purposes. However, you don’t have much control over the configuration of the hosted agent. It comes with most of tools you would normally require for building your source code. Now, when building PowerShell, it will come with latest version of PowerShell, so you can use built in package management cmdlets like Install-Module. Occasionally, you would need to install custom PowerShell modules such as SqlServer (Formerly known as SQLPS). Continue reading “Install PowerShell Modules on hosted agent in VSTS (Visual Studio Team Services)”

Understand Syntax of Azure Resource Manager (or ARM) Templates

The infrastructure for an application generally consists of many components. It consists of an application code itself, a server somewhere to run that code (typically a virtual machine), a storage to hold the data, a database and a network. You may also want to have integration with 3rd party services. So in order for your application to work, either you want to have all this in place, or none at all. Same is true whenever you would want to deploy your application in Microsoft Azure. Azure Resource Manager or ARM is a way to manage all interdependent parts as one resource group. You can deploy, update or delete all the resources required for your application to work.

With Azure Resource Manager, you can create a template that defines all the interdependent parts required for your application. This template is defined using JSON format. See more details on ARM templates here and about JSON here. In this blog post, we’ll understand the syntax to create ARM templates. Continue reading “Understand Syntax of Azure Resource Manager (or ARM) Templates”

VSTS Azure SQL Database Deployment task keeps failing with Error: Login failed for user

The task is used to deploy Azure SQL Database to an existing Azure SQL Server, either by using DACPACs or SQL Server scripts. The DACPACs are deployed using SqlPackage.exe and the SQL Server scripts are deployed using the Invoke-Sqlcmd cmdlet. DACPACs and SqlPackage.exe and Invoke-Sqlcmd cmdlet provides for fine-grained control over the database creation and upgrades, including upgrades for schema, triggers, stored procedures, roles, users, extended properties etc. Using the task, multiple different properties can be set to ensure that the database is created or upgraded properly.  Continue reading “VSTS Azure SQL Database Deployment task keeps failing with Error: Login failed for user”

List of most used linux commands for various purposes

I have found some time to sit together and make a list of most used linux commands by me on a personal basis. I’m sharing the same over here (this in no way intends to be a complete list or reference list, so please don’t feel offensive). I hope you can find the same useful:

System Information

dmesg (boot message)
dmesg | less (view line by line)

sudo lshw (complete hardware info about computer!)
uname -a (server info)
cat /etc/*release (OS)
df -hT (mounted file systems)
mount -l (lists all mounted filesystems)
env | sort (environmental variables) Continue reading “List of most used linux commands for various purposes”

Understand what Azure ARM templates are

The infrastructure for an application is typically made up of many components – a server to execute and respond to all calls, a storage mechanism to handle all I/O (input/output) , some kind of networking mechanism and finally off course, your application. Your application may be a standalone application with or without any database support and with or without any 3rd party integration services. You don’t generally want to see these components as separate entities or you may be (depending upon your background in Information Technology Sector) .

Generally, if you are a consumer, all you are concerned about is to consume how services available by a particular piece of the application. Continue reading “Understand what Azure ARM templates are”

Running PowerShell Core in a docker container

PowerShell core is the edition of PowerShell built on top of .NET Core. It is sometimes simplified to “CoreCLR”, though it technically includes CoreFX as well.

PowerShell Core is cross-platform, available on Windows, macOS, and Linux, thanks to the cross-platform nature of .NET Core. On PowerShell Core, $PSVersionTable.PSEdition is set to Core.

Do note that  while PowerShell Core 6.0 is cross-platform, there is also a PowerShell Core 5.0/5.1 released exclusively as part of Nano Server. In this blog post, we’ll learn how to run PowerShell core in a docker container. Continue reading “Running PowerShell Core in a docker container”

Remove images from Docker Images

You can remove an image using its short or long ID, its tag, or its digest in the Docker. For this we have to use the command:

docker rmi [OPTIONS] IMAGE [IMAGE...]

Where Options are:
-f, –force Force removal of the image
–help Print usage
–no-prune Do not delete untagged parents

Let’s see how this works. You cannot delete an image if it has been used to spawn containers or child images based on it. You would likely see an error message which resembles following:

Error response from daemon: conflict: unable to remove repository reference “mogo/ubuntu:telnet” (must force) – container 4888c45aa31c is using its referenced image a955c52ec9ec

Or Continue reading “Remove images from Docker Images”