Configuring and Securing credentials in PowerShell

Automation is great. However most of the time, while doing certain tasks, you need to use a different set of credentials then the current logged on user. You can put direct password in plain text inside script but this is not a best practice or recommended one. After all, passwords are safe only if they are kept secret. Writing them in clear text inside script defies the overall purpose. So we’ll see how to avoid this scenario. Let’s start with basics first.

We can get user credential by using cmdlet Get-Credential and storing them inside a variableRead More »

Enable PowerShell remoting on Azure RM virtual machines

PowerShell remoting is useful to manage virtual machines using PowerShell. When you create a virtual machine in the classic azure model, a winrm endpoint is automatically configured and can be used to manage virtual machines. You’ll just need to import ssl on your local machine and connect to the remoting session. However, same is not created if you create a virtual machine in the resource manager model. So if you try to connect using PowerShell remoting for azure rm vm, you’ll see Read More »

Deleting Azure Virtual Machines

Like other things, there are more than one way to delete Azure Virtual Machines. However with nearly all of them, you have a choice whether you want to delete vhds for the virtual machines or not. Sometimes it may be helpful to retain the disks for later use.

For delete virtual machine from classic portal, use below command:

$name = "mailserver01"
$serviceName = "mailsouthasia"
Remove-AzureVM -Name $name -ServiceName $serviceName

If we need to delete vhds as well, use below Read More »