-
Notifications
You must be signed in to change notification settings - Fork 36
StorageAccountService
The StorageAccountService class has a few methods beyond the common methods found in all ResourceBasedProviderService subclasses.
Getting at data within the storage account itself, such as blob or file data, requires a separate account key. Unless you are generating your own shared access signature, you will need to get a key to access the storage account.
sas = Azure::Armrest::StorageAccountService.new(conf)
sas.list_account_keys
Unlike most methods, this returns a plain, two-element hash with "key1" and "key2" as the keys with their corresponding value. In practice, you may use either key to access a storage account.
If you are concerned that your keys may have been compromised in some way, then you can regenerated your storage account keys:
sas.regenerate_storage_account_keys
In "classic" Azure, it was possible to retrieve a list of captured (private) images using their web interface. However, at the time of this writing, this capability does not exist in the newer (V2) portal. Consequently, a custom method called list_private_images was implemented that could approximate this behavior.
sas.list_private_images('some_resource_group').each{ |img| p img }
The list_private_images method returns an array of StorageAccount::PrivateImage objects. These are custom model objects that includes the standard blob information, as well as the storage account name, blob properties, the operating system, and the URI to the image.
The list_private_images method looks through all blobs, checking for files with an extension of .vhd. Then the properties on that VHD are checked. Only those VHD's with a lease state of "available", and in a "generalized" state are returned.