title: Shutting down VM returns all VM states as unknown
body: <p>When using the methods below to shutdown and query the role instances.  When I shutdown a VM all other role instances are returned with a status of ready state unknown.  After about a couple of minutes I can query again and get the actual status.  How can I get the actual status in real time, using Azure Management APIs.  Or is this an issue with how the VMs are configured?  They are configured with the same storage location and same virtual network</p>
  
  <p>The code shown was based off the template for Deploy and Manage Virtual Machines in Visual Studio 2015.</p>
  
  <p>The call to shutdown the VM:</p>
  
  <pre><code>var shutdownParams = new VirtualMachineShutdownParameters();
  
  if (deallocate)//deallocate is true in this instance
      shutdownParams.PostShutdownAction = PostShutdownAction.StoppedDeallocated; // Fully deallocate resources and stop billing
  else
      shutdownParams.PostShutdownAction = PostShutdownAction.Stopped; // Just put the machine in stopped state, keeping resources allocated
  
  await _computeManagementClient.VirtualMachines.ShutdownAsync(_parameters.CloudServiceName, _parameters.CloudServiceName, vmName, shutdownParams);
  </code></pre>
  
  <p>The call to query for all role instances
  <code>XXX_VirtualMachine</code> is a class that holds the name and instance status:</p>
  
  <pre><code>internal List&lt;XXX_VirtualMachine&gt; GetAllVirtualMachines()
  {
      List&lt;XXX_VirtualMachine&gt; vmList = new List&lt;XXX_VirtualMachine&gt;();
      try
      {
          DeploymentGetResponse deployment;
  
          deployment = _computeManagementClient.Deployments.GetByName(_parameters.CloudServiceName, _parameters.CloudServiceName);
  
          for (int i = 0; i &lt; deployment.RoleInstances.Count; i++)
          {
              vmList.Add(new XXX_VirtualMachine(deployment.RoleInstances[i].InstanceName, deployment.RoleInstances[i]));
          }
      }
      catch (Exception e)
      {
          System.Windows.Forms.MessageBox.Show(e.Message);
      }
      return vmList;
  }
  </code></pre>