move a VM to another subnet - Update-AzureVM : BadRequest: The virtual network I

This topic contains 2 replies, has 2 voices, and was last updated by  Salam Elias 2 years, 11 months ago.

  • Author
  • #25150

    Salam Elias

    Hi, I am following instructions on moving an existing VM in Azure to a Different Subnet as indicated at the url

    After adding my account, selecting scription and do Get-AzureVM, I get the following error

    [blockquote]Update-AzureVM : BadRequest: The virtual network ID cannot be null or empty.
    At line:1 char:7
    + $vm | Update-AzureVM
    + ~~~~~~~~~~~~~~
    + CategoryInfo : CloseError: [:] [Update-AzureVM], CloudException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.UpdateAzureVMCommand [/blockquote]

    The command

    [blockquote]Get-AzureVM –ServiceName TestVMCloud –Name TestVM | Set-AzureSubnet –SubnetNames Subnet-2 | Update-AzureVM
    has no parameter "Virtual network ID", so what is missing here?

    was using variables when getting the mentioned error like this

    [blockquote]Get-AzureVM-ServiceName $cloudServiceName -Name $vmName | Set-AzureSubnet -SubnetNames $subnetname | Update-AzureVM
    I replaced the variables with there values as follows (without quotes as suggested)

    [blockquote]Get-AzureVM -ServiceName myservice -Name MyAVM2 | Set-AzureSubnet -SubnetNames mysubnet | Update-AzureVM
    it did not work, I also tried using quotes

    [blockquote]Get-AzureVM -ServiceName 'myservice' -Name 'MyAVM2' | Set-AzureSubnet -SubnetNames 'mysubnet' | Update-AzureVM [/blockquote]

    I opened a thread on MS forums, they request to open a ticket and my subscription is an MSDN related subscription which has no technical support


  • #25154

    Rob Simmers

    Are you sure the subnet you are referencing is correct? It looks like there is a Get-AzureVnetSite cmdlet that lists the available subnets, so can you do Get-AzureVnetSite -VnetName mysubnet and access the subnet? My guess is that Set-AzureSubnet is doing a similar look up and cannot find the subnet with that name, so it's null.

  • #25179

    Salam Elias

    Dear Rob, executing only Get-AzureVnetSite or Get-AzureVnetSite -VNetName myNetwork
    [blockquote]AddressSpacePrefixes : {}
    Location : North Europe
    AffinityGroup :
    DnsServers : {salammain}
    GatewayProfile : Small
    GatewaySites : {}
    Id : *****************
    InUse : False
    Label :
    Name : salam****************k
    State : Created
    Subnets : {Subnet-1, GatewaySubnet}
    OperationDescription : Get-AzureVNetSite
    OperationId : 540d9a6a-3515-a147-b0e6-e725e4e65a9a
    OperationStatus : Succeeded
    So I have a subnet named "Subnet-1"

    when I run
    Get-AzureVnetSite -VNetName Subnet-1 or
    Get-AzureVnetSite -VNetName 'Subnet-1' or "Get-AzureVnetSite -VNetName Subnet-1"

    I get
    Get-AzureVNetSite : There were not enough free threads in the ThreadPool to complete the operation.

    Thanks again

You must be logged in to reply to this topic.