Azure VNet Gateway Setup fails for second pair - powershell

I am attempting to setup multiple VNet to VNet connections in Azure as described here: https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-configure-vnet-to-vnet-connection/
I have 4 VNets
VNet-North
VNet-South
VNet-East
VNet-West
I have been trying to setup a star topology with a Domain Controller in the center like this:
I have successfully setup VNet-North to VNet-South in both directions.
When I try to connect VNet-North to VNet-East using this PoewerShell command:
PS C:\> Set-AzureVNetGatewayKey -VNetName VNet-North -LocalNetworkSiteName VNet-East -SharedKey A1b2C3D4
It returns success
But when I try:
PS C:\> Set-AzureVNetGatewayKey -VNetName VNet-East -LocalNetworkSiteName VNet-North -SharedKey A1b2C3D4
Set-AzureVNetGatewayKey : BadRequest: The specified local network site name 'VNet-North' is not valid or could not be found.
At line:1 char:1
+ Set-AzureVNetGatewayKey -LocalNetworkSiteName VNet-North -SharedKey AaBaCaDa -VNetN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzureVNetGatewayKey], CloudException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.SetAzureVNetGatewayKey
Is a star topology possible?

Had the same problem, resolved by issuing Reset-AzureVNetGateway -VNetName "Name" against all parties having problem. This command will temporarily drop all connections on given VPN gateway, please use it with caution.

Related

Add Reserved IP to existing VM on azure

I have resource group "cbp.resourcegroup.neu" both my reserved IP and VM are in the same resource group
my reserved ip name is CBPIP-Dev-NEU
service name for my machine VM is testmachine which i have taken from as first part of DNS name "testmachine.northeurope.cloudapp.azure.com"
when i am running the following command to add reserved ip to VM
Set-AzureReservedIPAssociation -ReservedIPName Group cbp.resourcegroup.neu
CBPIP-Dev-NEU -ServiceName portrtestmachine
I am getting the following error.
Set-AzureReservedIPAssociation : Cannot validate argument on parameter
'Slot'. The argument "CBPIP-Dev-NEU" does not belong to the set
"Staging,Production" specified by the ValidateSet attribute. Supply an
argument that is in
the set and then try the command again.
At line:1 char:76
+ ... ion -ReservedIPName Group cbp.resourcegroup.neu CBPIP-Dev-NEU -Servic
...
+ ~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Set-AzureReservedIPAssociation], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.SetAzureReservedIPAssociationCmdlet
IS there anything i am missing in my command . I using powershell to do that.
Group cbp.resourcegroup.neu CBPIP-Dev-NEU
The spaces make the command think you are using positional paramters, so "CBPIP-Dev-NEU" is being passed to the -Slot parameter, for which that is not a valid value.
Try this instead
Set-AzureReservedIPAssociation -ReservedIPName "CBPIP-Dev-NEU" -ServiceName "portrtestmachine"
Azure reserved IP can only be assigned to a deployed PRODUCTION instance.
But that's useless, cause CloudServices already have static IP.
We should check the cloud service, make sure there is no static Public IP address.

Issue with setting up StorageAccountname while starting Azure machine through Powershell

I am trying to install and configure Azure Powershell and surprisingly I am facing issue with setting up of StorageAccountName parameter.
I have my vm setup on my enterprise account with resource group name as "RG-1" and storage account names as rg13675 and rg16461. I found these storage account names after drilling down to my resource group.
On running command,
Set-AzureRmCurrentStorageAccount –ResourceGroupName “RG-1” –StorageAccountName “rg16461"
My powershell throws up error:
Set-AzureRmCurrentStorageAccount : The Resource 'Microsoft.Storage/storageAccounts/rg16461' under resource group 'RG-1' was not found.
At line:1 char:1
+ Set-AzureRmCurrentStorageAccount –ResourceGroupName “RG-1” –StorageAc ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzureRmCurrentStorageAccount], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Management.Storage.SetAzureRmCurrentStorageAccount
The reason you're getting this error is because your storage account is a classic storage account (from the screenshot you shared) while the cmdlet expects a resource manager (ARM) storage account.
Please create a new storage account using Resource Manager deployment option and try to use that account's name in your cmdlet. That should fix the error.

Reserving static IP for existing Azure Virtual Machine

I have created 3 virtual machines which are already in operation and I forgot to first assign a static IP at time of creation. I am now encountering some issues when I am trying to do this.
I have created a reserved IP using the following powershell:
New-AzureReservedIP “dmz-live” –Label “be-dmz-ip” –Location “North Europe”
Following this post http://prmdbaora.blogspot.in/2015/06/normal-0-false-false-false-en-us-x-none.html I tried to delete the VM and reassign but when I use the following code:
New-AzureVMConfig -Name "be-dmz" -InstanceSize "Standard_D11" –ImageName "be-dmz-be-dmz-0-201508100952090393" | New-AzureVM -ServiceName "be-dmz" –ReservedIPName " be-dmz-ip " -Location "CloudVNET”
I am getting an error:
New-AzureVMConfig : Must specify MediaLocation or set a current storage account using Set-AzureSubscription.
At line:1 char:1
+ New-AzureVMConfig -Name "be-dmz" -InstanceSize "Standard_D11" -ImageName "be-dmz ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureVMConfig], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.NewAzure
VMConfigCommand
I have confirmed that the name of the disk is correct, after deleting the cloud service this disk was present but when I tried to run the command it deleted the disk and it is no longer showing in the list of disks
I want to add these machines to a virtual network called "CloudVNET". Can anyone give me a pointer as to what I am doing wrong here please and how I can go about assigned these reserved IPs to the machines

Security Token Validation Error with JWT token -- HDInsight

I created a new storage account and provisioned an HDInsight cluster on Windows Azure. However, when I try to run any command on Windows Azure Powershell related to the cluster, I get the following error:
PS C:\> Get-AzureHDInsightCluster -Name $clusterName
Get-AzureHDInsightCluster : Request failed with code:Unauthorized
Content:<Error xmlns="http://schemas.microsoft.com/windowsazure"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Code>AuthenticationFailed</Code><Message>A security token
validation error occured for the received JWT token.</Message></Error>
At line:1 char:1
+ Get-AzureHDInsightCluster -Name $clusterName
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-AzureHDInsightCluster], HttpLayerException
+ FullyQualifiedErrorId : Microsoft.Hadoop.Client.HttpLayerException,Microsoft.WindowsAzure.Management.HDInsight.C
mdlet.PSCmdlets.GetAzureHDInsightClusterCmdlet
I'm completely new to HDInsight, but I ran a script before this command to add the Azure account, create variables for the subscription name, storage account name, and container name from this page.
Do you know what this error means? And how to fix it? I'm trying to run a script with Pig commands after following this website.
It looks like the PowerShell environment is not properly setup. You should add your Azure subscription first with GetAzureSubscription. See: http://www.windowsazure.com/en-us/documentation/articles/install-configure-powershell/#Connect

How to deploy to Azure with powershell?

I want to deploy my application to azure with powershell. So far I have created a certificate in the localmachine store, I'm not going to run the deploy script as me, uploaded the script to azure. The next step is to get access to the service on azure in powershell but there it fails. The script I have so far is:
$cert = Get-Item Cert:\LocalMachine\deploy\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Set-AzureSubscription -SubscriptionName $subscriptionName -SubscriptionId $subscriptionId -Certificate $cert
Select-AzureSubscription $subscriptionName
$service = Get-AzureService $azureId
It fails on the last row with the following message:
Get-AzureService : Communication could not be established. This could be due to an invalid subscription ID. Note that subscription IDs are case sensitive.
At F:\DeployTest\deploy.ps1:9 char:12
+ $service = Get-AzureService $azureId
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-AzureService], Exception
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.ServiceManagement.HostedServices.GetAzureServiceCommand
Get-AzureService : HTTP Status Code: AuthenticationFailed - HTTP Error Message: The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription.
Operation ID:
At F:\DeployTest\deploy.ps1:9 char:12
+ $service = Get-AzureService $azureId
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureService], CommunicationException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.ServiceManagement.HostedServices.GetAzureServiceCommand
I really don't know what the problem is, the certificate I'm trying to use is uploaded so it feels like there is something fundamental I've missed.
Update: I did get it to work after downloading the .publishsettings-file and importing that instead of trying to use Set-AzureSubscription. I'm still a little bit confused though, shouldn't it be possible to use the method I tried above?
I finally found the problem, and of course it was a user problem. First when I was in the azure portal I didn't find where to upload the certificate, so I uploaded it to first place I found mentioning certificates. What I did found out was that this area was the wrong one, I uploaded the certificate to the certificate area under the cloud service I wanted to administrate, which is the wrong place.
The correct place to upload the certificate to is under settings in the admin portal of azure. So the code above works if the certificate is uploaded to the correct location.