Script for importing existing VMs into Azure Pack

As you start working with Azure Pack, you probably realize that you have a lot of existing VM’s that you would like to import into Azure Pack, and by that be able to use them just as you can handle all new ones?

All that’s needed for that, is to set the correct AzurePack user as the owner and SelfServicUuser on that Virtual Machine. And of course, have the machine in the correct “Cloud”.

Here is a small script which will help you out by;

  1. Asking in a Grid View, which Cloud you would like to import a machine in.
  2. Ask which user that should be the new owner of this VM.
  3. Let you pick, which VM from the Cloud you would like to import.

As we have multiple clouds, and users can have multiple subscriptions, I chose to make the script use GridView, to minimize the risk for human errors (typos).


3 thoughts on “Script for importing existing VMs into Azure Pack”

  1. thanks for your post, I got it work, however , I got error when try to go VM Dashboard properties about unable to locate VMMNetowrk properties, do you have idea how to fix? thanks!

  2. Just a quick suggestion : the -Replace “_.+”,”” part when displaying users will remove subscription information from users’ list. This might be good when each user only has a single subscription but when users might have multiple subscriptions assigned that makes impossible to know which subscription you will assign the VM to because script will show the same e-mail address multiple times.

    You might want to add a parameter to your script to deal with this, to decide if subscription info will be displayed or not.

    Thanks again.

Leave a Reply