Error: The term ‘Save-AzureRMProfile’ is not recognized as the name of a cmdlet, function, script file, or operable program

If you have recently installed Azure PowerShell module on one of the machines and then trying to login using Select-AzureRMProfile, you are likely to receive below error:

Save-AzureRMProfile : The term ‘Save-AzureRMProfile’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try againAt line:3 char:2+  Save-AzureRMProfile -Path “C:\$SubscriptionName.json”+  ~~~~~~~~~~~~~~~~~~~    + CategoryInfo          : ObjectNotFound: (Save-AzureRMProfile:String) [], CommandNotFoundException    + FullyQualifiedErrorId : CommandNotFoundException

I checked the list of cmdlets and it was gone. Continue reading “Error: The term ‘Save-AzureRMProfile’ is not recognized as the name of a cmdlet, function, script file, or operable program”

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”

Navigate to current user’s path in PowerShell

I guess everyone knows that you can find current logged-in user’s profile path using variable $env:USERPROFILE, which is one of the built in environmental variables in PowerShell. However, you can also choose to navigate to current user’s profile path using ‘~’ (without single quotes). So for an example would be:

PS data [07/11/2017 09:58:00]> pwd


PS data [07/11/2017 09:58:01]> cd ~
PS mogoyal[07/11/2017 09:58:05]> pwd


However, unlike $env:userprofile, you can not use this in write-host to print out the value of the path.

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”

New methods of DevOps – a food for thoughtful strategy

DevOps is the new buzzword these days. It is more of a culture and there is no single definition that can summarize what is DevOps. For more technical guys like us, DevOps is more about automation and improving the values delivered to business. Over the time, we have seen the tools and processes evolve to provide better management, better processes and better automation. So the focus of this blog post is solely about how what was used as a part of process and tools when DevOps started and how it has changed over the years.

Let’s first see the definition of DevOps, as quoted from wikipedia:

DevOps (a clipped compound of “development” and “operations”) is a software development process that emphasizes communication and collaboration between product management, software development, and operations professionals. DevOps also automates the process of software integration, testing, deployment and infrastructure changes. It aims to establish a culture and environment where building, testing, and releasing software can happen rapidly, frequently, and more reliably.

Continue reading “New methods of DevOps – a food for thoughtful strategy”

Change directory to store containers and images in Docker

As discussed in one of the previous posts, docker is more focused on ease of use and not so much on the disk space efficiency out of the box. However, it is our responsibility to maintain adequate free space on hard disk and also do some kind of standardization. DevOps is not only about automation but it is also about standardization of process thereby removing any gotchas or discrepancy in the configuration. For example, we may like to store docker images in a separate directory that may be located on a mounted device storage or some other easy to navigate configuration.

By default, docker store containers and images in /var/lib/docker by default:

Default directory for containers and images in Docker
Default directory for containers and images in Docker

Continue reading “Change directory to store containers and images in Docker”