Add Reserved IP to existing VM on azure - powershell

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.

Related

Get-MailboxDatabase -status throws DataValidationException

When calling
Get-MailboxDatabase -Status
we get the following Exception in one environment:
You must provide a value for this property. Property Name: HostServer
+ CategoryInfo : NotSpecified: (0:Int32) [Get-MailboxDatabase], DataValidationException
+ FullyQualifiedErrorId : 1401E8AF,Microsoft.Exchange.Management.SystemConfigurationTasks.GetMailboxDatabase
+ PSComputerName : XXXXXXXXX
We tried to execute the command while connected to a server having (only) the hub transport role and on a server having the mailbox role. Both throw the same error. When we omit the -Status parameter, we get the list of all databases as expected (but without the required status information).
Since the command fails on 2 different servers of the same Organization while it is working in all other organizations, I suspect the problem is originated in AD. Any idea what could cause the issue?

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

Azure VNet Gateway Setup fails for second pair

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.

DefaultWinRMCertificateThumbprint field in Azure VM setting is empty

I'm using "http://gallery.technet.microsoft.com/scriptcenter/Configures-Secure-Remote-b137f2fe" for configuring secure remote powershell access to my Azure VM. It works good.
I deleted my machine with keeping attached disks. I've recreated this machine with previous identical parameters, but from "my disk" option.
And after that my secure remote powershell access stop working. Every time I tried to use "http://gallery.technet.microsoft.com/scriptcenter/Configures-Secure-Remote-b137f2fe" for downloading certificate i recieved the following error:
Get-AzureCertificate : Cannot validate argument on parameter 'Thumbprint'. The argument is null or empty. Supply an argument that is not null or empty and then try the command again.
At C:\Users\username\Desktop\InstallWinRMCertAzureVM.ps1:54 char:83
+ ... me -Thumbprint $WinRMCert -ThumbprintAlgorithm sha1
+ ~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-AzureCertificate], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.WindowsAzure.Commands.ServiceManagement.Certi
ficates.GetAzureCertificate
Actually, the option
(Get-AzureVM -ServiceName $CloudServiceName -Name $Name | select -ExpandProperty vm).DefaultWinRMCertificateThumbprint
is empty.
But in original machine it was a valid thumbprint.
Can someone point me in the right direction, please?
Problem was fixed. Partially :)
So, I connected to my virtual machine via RDP and manually export certificate from LocalMachine store. After that, I've imported certificate to my local machine to the "Trusted Root Certification Authorities" (!) section in Local Machine store. DefaultWinRMCertificateThumbprint field in Azure VM setting is still empty, but now I can connect to machine via Powershell without any problems.