A Ruby interface for Azure using the new REST API.
require 'azure/armrest'
# Create a configuration object. All service objects will then use the
# information you set here.
#
# A token will be retrieved based on the information you provided
conf = Azure::Armrest::ArmrestService.configure(
:client_id => 'XXXXX',
:client_key => 'YYYYY',
:tenant_id => 'ZZZZZ',
:subscription_id => 'ABCDEFG'
)
# This will then use the configuration info set above.
# You can add other options specific to the service to be created
vms = Azure::Armrest::VirtualMachineService.new(conf, options)
# List all virtual machines for a given resource group:
vms.list(some_group).each do |vm|
puts vm.name
puts vm.resource_group
puts vm.location
puts vm.properties.hardware_profile.vm_size
end
If you do not provide a subscription ID in your configuration object, then the first subscription ID returned from a REST call will be used.
Currently only the client credentials strategy is supported. Support for other strategies may be added over time.
The gem is available as open source under the terms of the Apache License 2.0.
- Daniel Berger
- Bronagh Sorota
- Bill Wei