Search code examples
powershellazureazure-cloud-servicesazure-resource-managerazure-resource-group

Set Azure Reserved IP on cloud service via powershell


as said in the title, I can't assign an IP to my cloud service.

I've followed a lot of forums and StackOverflow articles/posts but I've still the issue.

When I try to run

Set-AzureReservedIPAssociation -ReservedIPName primosguardo365reservedip -ServiceName primosguardo365

I get this error

Set-AzureReservedIPAssociation : ResourceNotFound: No deployments were found.
At line:1 char:1
+ Set-AzureReservedIPAssociation -ReservedIPName primosguardo365reserve ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Set-AzureReservedIPAssociation], CloudException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.SetAzureReservedIPAssociationCmdlet

but if I try to get the resources using the same name

λ  Get-AzureReservedIP

ReservedIPName       : Group Primosguardo365 primosguardo365reservedip
Address              : **.**.**.**
Id                   : ******************
Label                :
Location             : West Europe
State                : Created
InUse                : False
ServiceName          :
DeploymentName       :
VirtualIPName        :
OperationDescription : Get-AzureReservedIP
OperationId          : ************************
OperationStatus      : Succeeded


λ  Get-AzureService "primosguardo365"

ServiceName             : primosguardo365
Url                     : https://management.core.windows.net.................
Label                   : primosguardo365
Description             : primosguardo365
Location                : West Europe
AffinityGroup           :
Status                  : Created
ExtendedProperties      : {[ResourceGroup, Primosguardo365], [ResourceLocation, westeurope], [ProvisioningSource,
                          AzureResourceManager]}
DateModified            : 28/03/2017 12:13:20
DateCreated             : 28/03/2017 11:26:03
ReverseDnsFqdn          :
WebWorkerRoleSizes      : {}
VirtualMachineRoleSizes : {}
OperationDescription    : Get-AzureService
OperationId             : ****************************
OperationStatus         : Succeeded

Does anyone have any suggestion?

Thanks in advance!

EDIT:

VIP can only be assigned to a deployed PRODUCTION instance.

But that's useless, cause CloudServices already have static IP.

Thanks to all!


Solution

  • In my test, I reproduce your error, I just create a cloud service via new portal, and then associate a reserved IP address to it, the error occur.

    PS C:\Users> Set-AzureReservedIPAssociation -ReservedIPName my9 -ServiceName "jasontest323"
    Set-AzureReservedIPAssociation : ResourceNotFound: No deployments were found.
    At line:1 char:1
    + Set-AzureReservedIPAssociation -ReservedIPName my9 -ServiceName "jaso ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : CloseError: (:) [Set-AzureReservedIPAssociation], CloudException
        + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.SetAzureReservedIPAssociationCmdlet
    

    After that, I create another cloud service and a VM, then assiscate a reserved IP address to this cloud service, it works.

    PS C:\Users> Set-AzureReservedIPAssociation -ReservedIPName my9 -ServiceName "jasonvm3659"
    
    OperationDescription           OperationId                          OperationStatus
    --------------------           -----------                          ---------------
    Set-AzureReservedIPAssociation 05ccff35-5642-7cc6-9c6b-b5dfe2d1603d Succeeded
    

    So, I check the status of the two cloud service, I find when the Production is running, the command will work. enter image description here

    enter image description here

    We can use PowerShell to check the deployment:

    PS C:\Users> Get-AzureDeployment -ServiceName jasontest323
    Get-AzureDeployment : ResourceNotFound: No deployments were found.
    OperationID : '27da300bc3c67a5bbdbc954c1c19e3e7'
    At line:1 char:1
    + Get-AzureDeployment -ServiceName jasontest323
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : CloseError: (:) [Get-AzureDeployment], ComputeCloudException
        + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.HostedServices.GetAzureDeploymentCommand
    
    PS C:\Users> Get-AzureDeployment -ServiceName jasonvm3659
    
    
    SdkVersion                :
    RollbackAllowed           : False
    Slot                      : Production
    Name                      : jasonvm3659
    DeploymentName            : jasonvm3659
    Url                       : http://jasonvm3659.cloudapp.net/
    Status                    : Running
    CurrentUpgradeDomain      : 0
    CurrentUpgradeDomainState :
    UpgradeType               :
    RoleInstanceList          : {jasonvm}
    Configuration             : <ServiceConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
                                  <Role name="jasonvm">
                                    <Instances count="1" />
                                  </Role>
                                </ServiceConfiguration>
    DeploymentId              : fc627acb502a4a979b08c42f69cccf72
    Label                     : jasonvm3659
    VNetName                  : Group jasontest321 jasontest321
    DnsSettings               :
    OSVersion                 :
    RolesConfiguration        : {[jasonvm, Microsoft.WindowsAzure.Commands.ServiceManagement.Model.RoleConfiguration]}
    VirtualIPs                : {jasonvm3659ContractContract}
    ReservedIPName            : my9
    CreatedTime               : 3/29/2017 1:10:28 PM
    LastModifiedTime          : 3/29/2017 1:27:42 PM
    Locked                    : False
    InternalLoadBalancerName  :
    LoadBalancers             : {}
    ExtensionConfiguration    :
    ServiceName               : jasonvm3659
    OperationDescription      : Get-AzureDeployment
    OperationId               : f8b8xxxx-xxxx-xxxx-xxxx-xxxx2cdc1daa
    OperationStatus           : Succeeded
    

    The reserved IPs work for classic module, only be used for VMs and cloud service instance roles exposed through a VIP.

    So we should check the deployment with powershell Get-AzureDeployment -ServiceName primosguardo365 first.