Skip to content

Commit

Permalink
updated client to automatically call refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
azurecoder committed Apr 2, 2013
1 parent 153eb1b commit a956d72
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -98,6 +98,8 @@ public IVirtualMachineClient CreateNewVirtualMachineFromTemplateGallery(WindowsV
Certificate = properties.Certificate
};
startCommand.Execute();
// important here to force a refresh - just in case someone to conduct an operation on the VM in a single step
var vm = VirtualMachine;
// create a new client and return this so that properties can be populated automatically
return new WindowsVirtualMachineClient(properties);
}
Expand All @@ -110,6 +112,11 @@ public IVirtualMachineClient CreateNewVirtualMachineFromTemplateGallery(WindowsV
/// <param name="removeStorageAccount">The storage account that the vhd is in</param>
public void DeleteVirtualMachine(bool removeDisks = true, bool removeCloudService = true, bool removeStorageAccount = true)
{
// set this if it hasn't been set yet
PersistentVMRole vm = null;
if (_vmRole == null)
vm = VirtualMachine;

// first delete the virtual machine command
var deleteVirtualMachine = new DeleteVirtualMachineCommand(Properties)
{
Expand Down

0 comments on commit a956d72

Please sign in to comment.