Azure Resource Group Error: A parameter cannot be found that matches parameter name ‘EnvironmentName’

Recently, if you have been trying to deploy Azure Resource Group template using Visual Studio, you might see below error:

[ERROR] Add-AzureRmAccount : A parameter cannot be found that matches parameter name 
[ERROR] 'EnvironmentName'.
[ERROR] At line:1 char:2379
[ERROR] + ... xmg' -AccountId 'myemail@gmail.com' -EnvironmentName 'AzureC ...
[ERROR] +                                                  ~~~~~~~~~~~~~~~~
[ERROR]     + CategoryInfo          : InvalidArgument: (:) [Add-AzureRmAccount], Param 
[ERROR]    eterBindingException
[ERROR]     + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Azure.Commands. 
[ERROR]    Profile.AddAzureRMAccountCommand
[ERROR]  
[ERROR] Run Login-AzureRmAccount to login.

Continue reading “Azure Resource Group Error: A parameter cannot be found that matches parameter name ‘EnvironmentName’”

Save profiles for all Azure subscriptions in one go

As discussed in one of the previous blog posts, we can use PowerShell to help create persistent logins. Now consider scenario, where you have access to multiple azure subscriptions. Off course, you can download and save AzureRM profile for each one of the them. However, there are two major issues:

  1. AzureRM profile downloaded is associated with a token by default and it expires in a few days.
  2. If you have too many subscriptions, it can be tiresome to first select subscription and then save the profile.

Continue reading “Save profiles for all Azure subscriptions in one go”

Persistant Azure PowerShell Logins

While doing azure automation from some time, I have found that I have to login each time I run a new PowerShell session. This is irritating while writing and executing scripts. You can do this manually by configuring the management certificate and subscription details with the Set-AzureSubscription and Select-AzureSubscription cmdlets or automatically by downloading the PublishSettings file from Windows Azure and importing it. In this blog post, we’ll see how to automate the login process for Microsoft Azure so that our script can run without any manual intervention.  Continue reading “Persistant Azure PowerShell Logins”

Invoke Azure Automation jobs using PowerShell

We can use PowerShell cmdlet Get-AzureRmAutomationRunbook to get runbooks associated with an automation account:

$resourceGroupName = "enggdevsoutheastasia"
$automationAccountName = "AzureAutomation"
$runbookName = "start-azurevms"
Get-AzureRmAutomationRunbook -automationAccountName $automationAccountName `
 -resourceGroupName $resourceGroupName

Similarly, we can use cmdlet Start-AzureRmAutomationRunbook …Continue Reading

Get Azure virtual machine extensions

Azure virtual machines have a variety of built-in extensions that can enable configuration management. There are two extensions for Windows PowerShell. The custom script extension allows you to run a script on a virtual machine at provisioning time or after it is running. The Windows PowerShell DSC Extension allows you to define the state of a virtual machine using the PowerShell Desired State Configuration language and apply it. There are also extensions that allow you to configure your virtual machines to use open source configuration management utilities such as Chef or Puppet …Continue Reading