Symptom:
When we create a VNet-to-VNet connection in Azure, the last step is to set the same IPsec/IKE pre-shared keys for the Virtual Networks. This can be done via the Set-AzureVNetGatewayKey cmdlet in Azure PowerShell.
However, when we use the Set-AzureVNetGatewayKey cmdlet in Azure PowerShell, we may receive the similar error below:
Figure 1.Error message when using the Set-AzureVNetGatewayKey cmdlet in Azure PowerShell
Cause:
As the error message said, the Set-AzureVNetGatewayKey cmdlet is not recognized by the old versions of Azure PowerShell since it is a new cmdlet.
Solution:
Install the latest version of Azure PowerShell.
You can install the latest version of Azure PowerShell from the link below:
http://azure.microsoft.com/en-us/documentation/articles/install-configure-powershell/
In addition, you can check the current version of Azure PowerShell on your local computer by running the commands below:
(Get-Module Azure).version or
Get-Module (It displaysthe versions of all the module in your Azure PowerShell environment)
From the figure below, you can see that the version of Azure PowerShell is 0.8.7.
Figure 2. Check the version of Azure PowerShell
After installing the latest version of Azure PowerShell on your local computer, you can run the Set-AzureVNetGatewayKey cmdlet successfully.
From figure 3, we can see that no error message displayed any more.
Figure 3. Run the Set-AzureVNetGatewayKey cmdlet successfully in Azure PowerShell
More information:
Configure a VNet to VNet Connection
http://msdn.microsoft.com/en-us/library/azure/dn690122.aspx
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.