Using .net sdk to start an VM that was previously unallocated

18 Views Asked by At

I have just about everything working to be able to dynamically turn on off VM's. The hibernating is working fine but, for the life of me, can't find what to do to turn the VM back on. Within the Azure site just pressing the start button is all that's needed - however I cannot find an equivalent in the SDK. I'm guessing I'm missing something obvious.

To turn off Im using

using Azure.ResourceManager.Compute;
var result = client.GetVirtualMachineResource(new ResourceIdentifier(id));
await result.DeallocateAsync(Azure.WaitUntil.Completed);

client doesn't not seem to have a Start call. If I use Power On it tells me the VM needs to be in a power off state first.

What am I missing TIA

1

There are 1 best solutions below

0
glose On

Well that was so easy it is embarrassing. It's the PowerOn command - I sure thought I had tried that and received an error but today it is working fine.

So Deallocate / PowerOn.