class Azure::Profile::Subscription

A class that represents an invididual subscription with an Azure profile.

Constants

DEFAULT_MANAGEMENT_ENDPOINT

Attributes

default[RW]

Returns whether or not this is a default subscription

environment_name[RW]

Azure environment name, e.g. “AzureCloud”

management_certificate[RW]

Azure certificate, a combination of the cert + key

management_endpoint[RW]

Azure endpoint. The default is management.core.windows.net

registered_providers[RW]

An array of registered providers

source[RW]

The source of the subscription, e.g. “~/.azure/azureProfile.json”

subscription_id[RW]

Azure subscription ID.

subscription_name[RW]

Azure subscription name, e.g. “Free Trial”

Public Class Methods

new() { |self| ... } click to toggle source

Creates and returns a new Subscription object. If a block is given then the object is yielded to the block.

Example:

# These values are for demonstration purposes only
Subscription.new do |s|
  s.subscription_id = 'abc-123-xyz'
  s.subscription_name = 'My Subscription'
  s.source = 'me'
  s.default = false
  s.management_certificate = generate_my_cert(Etc.getlogin)
  s.environment_name = 'MyEnvironment'
end

If no :management_endpoint is provided, then it will default to using Subscription::DEFAULT_MANAGEMENT_ENDPOINT. If no :source is provided, then it will default to ‘ruby’. If no :default is provided, it will default to false. If no :environment_name is provided, it will default to ‘AzureCloud’.

There is no default for the :registered providers or :management_certificate accessors. You must provide those. The certificate should be a combination of the cert and key so that you can pass its value directly to another interface, such as the azure gem.

Note that you will not normally create Subscription objects directly. The Azure::Profile class will generate them and pass them back to you.

# File lib/azure/profile/subscription.rb, line 60
def initialize
  yield self if block_given?

  @management_endpoint ||= DEFAULT_MANAGEMENT_ENDPOINT
  @source ||= 'ruby'
  @default ||= false
  @environment_name ||= 'AzureCloud'
end