Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Support #10

Open
2 of 5 tasks
mafernando opened this issue May 18, 2015 · 4 comments
Open
2 of 5 tasks

Azure Support #10

mafernando opened this issue May 18, 2015 · 4 comments
Assignees

Comments

@mafernando
Copy link
Contributor

To Do:

  • Modify Jellyfish-fog to bring in Azure Infrastructure Product types
  • Port over functionality from Jellyfish-Azure
    • Needs to be modified to auto-select Fog Azure provisioner on checkout
  • Port Azure specs
  • Update Azure docs with instructions on how to prep VM for image capture
@mafernando
Copy link
Contributor Author

References:

Useful Snippets:

# List virtual machine images provisionable from subscribtion 
foo = Azure::VirtualMachineImageManagement::VirtualMachineDiskManagementService.new
foo.list_virtual_machine_disks

# List virtual machines that are currently provisioned 
foo = Azure::VirtualMachineManagementService.new
foo.list_virtual_machines

@mafernando
Copy link
Contributor Author

Azure To Do:

  • Add ability to provision VM
    • Can provision in mock mode, but attempts to provision on Azure IRL are not working because of the consistently occurring error: The virtual machine image source is not valid.
    • Azure doesn't provide access to default provisionable VM images, instead you need to create a VM through the Azure Management Portal. Then you can generate a VM image from that instance which you can to create new VM instances via Fog/Azure Ruby SDK.
    • Provisioning a VM logs a result which contains plaintext password - understand if this is security risk
    • Once submitted, it takes several minutes before the provisioned VM is up and running. May need to poll VMs until status changes to running?
    • Retiring a VM doesn't delete the associated storage (include substep to do this?)
  • Add ability to provision Storage
  • Add ability to provision Databases

@mafernando
Copy link
Contributor Author

Notes:

  • All virtual machines in Azure are configured with at least two disks when you create the virtual machine – one is an operating system disk and the other is a temporary local disk, sometimes called a resource disk. The operating system disk is created from an image, and both the operating system disk and the image are actually virtual hard disks (VHDs) stored in an Azure storage account. Virtual machines also can have data disks, and those are also stored at VHDs.
  • when naming resources, account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.

@mafernando
Copy link
Contributor Author

How to Prop up Azure VM images

Choose selection from Azure Image Gallery:
http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-create-custom/

Login to the VM to prep it for cloning:
http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-how-to-log-on/

Template the VM to use as a base for clones:
http://blogs.technet.com/b/keithmayer/archive/2013/01/17/step-by-step-templating-vms-in-the-cloud-with-windows-azure-and-powershell-31-days-of-servers-in-the-cloud-part-17-of-31.aspx

Example Implementation

In Azure, first create a new Windows Server 2012 Datacenter base VM from Gallery.

image

Then connect to the VM and run the System Preparation Tool which will shutdown the VM. When the VM is shutdown, select the VM in the management portal and capture an image from it. When capturing a VM to an image, the original VM that is captured will be deleted from your Windows Azure subscription account. The original VM is replaced by the newly captured image

# Use this command to list provisionable VM images
foo = Azure::VirtualMachineImageManagement::VirtualMachineDiskManagementService.new
foo.list_virtual_machine_disks

# Sample Response - specify @image as :image attribute for provisioning
#<Azure::VirtualMachineImageManagement::VirtualMachineDisk:0x007fb3dde310a0
#  @attached=false,
#  @image="custom_vm_image.vhd",
#  @name="vmname",
#  @os_type="Windows",
#  @size="128">

# Create a new Fog Azure Connection
azure = Fog::Compute.new(
  :provider => 'Azure',
  :azure_sub_id => 'subscription_id',
  :azure_pem =>    'azure.pem',
  :azure_api_url => 'https://management.core.windows.net'
)

# Provision the Server
# This does not enable Remote Desktop
server = azure.servers.create(
    :image  => 'custom_vm_image.vhd',
    :location => 'West US',
    :vm_name => 'fogtest',
    :vm_user => "user",
    :password =>  "ComplexPassword!123",
    :storage_account_name => 'fogteststorage'
)

# Delete a virtual machine service object
virtual_machine_service = Azure::VirtualMachineManagementService.new
virtual_machine_service.delete_virtual_machine('fogtest', 'fogteststorage')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant