azure_mapping.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. Azure - Labeled Resources
  2. -------------------------
  3. ===================================== ====================== ===== ====================== ==================================
  4. Labeled CloudBridge Resource Azure Resource Type CB ID CB Name CB Label
  5. ===================================== ====================== ===== ====================== ==================================
  6. AzureInstance Virtual Machine ID Name tag:Label
  7. AzureMachineImage (Private) Image ID Name tag:Label
  8. AzureMachineImage (Marketplace Image) VirtualMachineImage ID URN URN
  9. AzureNetwork Virtual Network ID Name tag:Label
  10. AzureSubnet Subnet ID NetworkName/SubnetName Network:tag:SubnetLabel_SubnetName
  11. AzureRouter Route Table ID Name tag:Label
  12. AzureVolume Disk ID Name tag:Label
  13. AzureSnapshot Snapshot ID Name tag:Label
  14. AzureVMFirewall Network security group ID Name tag:Label
  15. ===================================== ====================== ===== ====================== ==================================
  16. The resources listed above are labeled, they thus have both the `name` and
  17. `label` properties in CloudBridge. These resources require a mandatory `label`
  18. parameter at creation. The `label` will then be used to create the `name`,
  19. which will consist of up to 55 characters from the label, followed by a UUID.
  20. The label property can subsequently be changed, but the name property will
  21. remain unchanged, as it is part of the ID. Finally, labeled resources support
  22. a `label` parameter for the `find` method in their corresponding services.
  23. The below screenshots will help map these properties to Azure objects in the
  24. web portal.
  25. Additionally, although Azure Security Groups are not associated with a
  26. specific network, such an association is done in CloudBridge, due to its
  27. necessity in AWS. As such, the VMFirewall creation method requires a
  28. `network` parameter and the association is accomplished in OpenStack through
  29. a tag with the key `network_id`.
  30. .. figure:: captures/az-label-dash.png
  31. :alt: name and label properties in Azure portal
  32. The CloudBridge `name` property always maps to the unchangeable resource
  33. name in Azure. The `label` property maps to the tag with key 'Label' for
  34. most resources in Azure. By default, this label will appear in the tags
  35. column, but can also be made into its own column, using the feature
  36. pointed out in the screenshot above.
  37. .. figure:: captures/az-net-id.png
  38. :alt: network id in Azure portal
  39. The CloudBridge `ID` property most often maps to the Resource ID in Azure,
  40. which can be found under the properties tab within a resource. The above
  41. screenshot shows where to find a resource's ID in Azure's web portal.
  42. .. figure:: captures/az-net-label.png
  43. :alt: network label in Azure portal
  44. The CloudBridge `label` property most often maps to the tag with key
  45. 'Label' in Azure, which can be found under the tags tab within a resource.
  46. The above screenshot shows where to find a resource's label in Azure's
  47. web portal.
  48. Two labeled resources are exceptions to the general trends presented above,
  49. namely public images (i.e. Azure Marketplace Images) and subnets.
  50. These public images can be found in the Azure Marketplace, and cannot be
  51. found on a user's dashboard. A Marketplace Image can be passed either by URN,
  52. or by public ID, and does not need to be linked to a user. While all
  53. Marketplace images will not be be listed by the find or list methods at the
  54. moment, a pre-set list of popular images is built into CloudBridge for that
  55. purpose. However, one can choose to list all Marketplace Images using the
  56. `list_marketplace_images` function in the azure client. Specifically,
  57. this can be done as follows:
  58. .. code-block:: python
  59. # List all images
  60. # Note that in September 2018, around 10 minutes of wall time were required
  61. # to fetch the entire list
  62. provider.azure_client.list_marketplace_images()
  63. # List all images published by Canonical
  64. provider.azure_client.list_marketplace_images(publisher='Canonical')
  65. # List all Ubuntu images
  66. provider.azure_client.list_marketplace_images(publisher='Canonical',
  67. offer='UbuntuServer')
  68. # List all Ubuntu 16.04 images
  69. provider.azure_client.list_marketplace_images(publisher='Canonical',
  70. offer='UbuntuServer',
  71. sku='16.04.0-LTS')
  72. # The ID of the listed object can then be used to retrieve an instance
  73. img = provider.compute.images.get
  74. ('/Subscriptions/{subscriptionID}/Providers/Microsoft.Compute/\
  75. Locations/{regionName}/Publishers/Canonical/ArtifactTypes/VMImage\
  76. /Offers/UbuntuServer/Skus/16.04.0-LTS/Versions/16.04.201808140')
  77. # The URN can also be used instead if it is already known
  78. # When the latest version is desired, it can be retrieved with the
  79. # keyword 'latest' in the URN without specifying a version
  80. img = provider.compute.images.get(
  81. 'Canonical:UbuntuServer:16.04.0-LTS:latest')
  82. Given that these resources are not owned by the user, they can only be
  83. referenced and all setters will silently pass. CloudBridge properties `name`
  84. and `label` will map to the URN, while the `ID` will map to the public `ID`.
  85. It is also important to note that some of these resources are paid and
  86. required a plan to use, while others are free but likewise require accepting
  87. certain terms before being used. These plans and terms are passed and
  88. accepted silently by CloudBridge in order to keep the code cloud-independent.
  89. We therefore encourage using the `marketplace website<https://azuremarketplace.microsoft.com/en-us>`_
  90. to view image and plan details before using them in CloudBridge.
  91. Additionally, Subnets are a particular resource in Azure because they are
  92. not simply found in the Resource Group like most resources, but are rather
  93. nested within a network. Moreover, Subnets do not support tags in Azure.
  94. However, they remain a labeled resource in CloudBridge, which was
  95. accomplished by creating Network tags holding Subnet labels in Azure. The
  96. below screenshots will show how to find Subnets and their labels in the
  97. Azure web portal.
  98. .. figure:: captures/az-subnet-name.png
  99. :alt: subnet name in Azure portal
  100. The CloudBridge `name` property for Subnets corresponds to the
  101. unchangeable Resource Name in Azure. However, unlike other resources
  102. where the Azure Name maps directly to the `name` property alone, a Subnet's
  103. `name` property returns the Network's name and the Subnet's name,
  104. separated by a slash, thus having the format [networkName]/[subnetName].
  105. Subnets are additionally not found in the default resource list, but are
  106. rather nested within a Network, in the Subnets tab as shown above.
  107. .. figure:: captures/az-subnet-label.png
  108. :alt: subnet label in Azure portal
  109. The CloudBridge `label` property most often maps to the tag with key
  110. 'Label' in Azure, which can be found under the tags tab within a resource.
  111. However, given that Subnets can't hold tags themselves, we set their tags
  112. in the Network with which they are associated. The tag name 'Label' thus
  113. corresponds to the Network's label, while each contained Subnet will have
  114. a corresponding tag with the name 'SubnetLabel_[subnetName]'.
  115. Azure - Unlabeled Resources
  116. ---------------------------
  117. ================== ====================================== ===== ======= ========
  118. Unlabeled Resource Azure Resource Type CB ID CB Name CB Label
  119. ================== ====================================== ===== ======= ========
  120. AzureKeyPair StorageAccount:Table Name Name -
  121. AzureBucket StorageAccount:BlobContainer Name Name -
  122. AzureBucketObject StorageAccount:BlobContainer:BlockBlob Name Name -
  123. ================== ====================================== ===== ======= ========
  124. The resources listed above are unlabeled. They thus only have the `name`
  125. property in CloudBridge. These resources require a mandatory `name`
  126. parameter at creation, which will directly map to the unchangeable `name`
  127. property. Additionally, for these resources, the `ID` property also maps to
  128. the `name` in Azure, as these resources don't have an `ID` in the
  129. traditional sense and can be located simply by name. Finally, unlabeled
  130. resources support a `name` parameter for the `find` method in their
  131. corresponding services.
  132. .. figure:: captures/az-storacc.png
  133. :alt: storage account in Azure portal
  134. Bucket and Key Pair objects are different than other resources in Azure,
  135. as they are not resources simply residing in a resource group, but are
  136. rather found in a storage account. As a result of this difference, these
  137. resources do not support labels, and cannot be seen on the default
  138. dashboard. In order to find these resources in the Azure web portal, one
  139. must head to the storage account containing them, and look in the `Blobs`
  140. and `Tables` services respectively for `Buckets` and `KeyPairs`.
  141. Azure - Special Unlabeled Resources
  142. -----------------------------------
  143. ==================== ====================== ================== ================== ========
  144. Unlabeled Resource Azure Resource Type CB ID CB Name CB Label
  145. ==================== ====================== ================== ================== ========
  146. AzureFloatingIP Public IP Address ID [public_ip] -
  147. AzureInternetGateway None cb-gateway-wrapper cb-gateway-wrapper -
  148. AzureVMFirewallRule Network Security Rules ID name -
  149. ==================== ====================== ================== ================== ========
  150. While these resources are similarly unlabeled, they do not follow the same
  151. general rules as the ones listed above. Firstly, they differ by the fact
  152. that they take neither a `name` nor a `label` parameter at creation.
  153. Moreover, each of them has other special properties.
  154. The FloatingIP resource has a traditional resource ID, but instead of a
  155. traditional name, its `name` property maps to its Public IP. Thus, the name
  156. seen in the Azure web portal will not map to the CloudBridge name, but will
  157. rather be auto-generated, while the Azure `IP Address` will map to CloudBridge
  158. name. Moreover, the corresponding `find` method for Floating IPs can thus help
  159. find a resource by `Public IP Address`, and the get method also accepts a
  160. 'Public IP' instead of an 'ID'.
  161. In terms of the gateway, one of the major discrepancies in Azure is the
  162. non-existence of an InternetGateway. In fact, Azure resources are exposed
  163. with no need for an Internet gateway. However, in order to keep resources
  164. consistent across providers, the CloudBridge Gateway resource exists
  165. regardless of provider. For Azure, the gateway object created through
  166. CloudBridge will not appear on the dashboard, but will rather be a cached
  167. CloudBridge-level wrapper object.
  168. For a succinct comparison between AWS Gateways and Azure, see `this answer
  169. <https://social.msdn.microsoft.com/Forums/en-US/
  170. 814ccee0-9fbb-4c04-8135-49d0aaea5f38/
  171. equivalent-of-aws-internet-gateways-in-azure?
  172. forum=WAVirtualMachinesVirtualNetwork>`_.
  173. Finally, Firewall Rules in Azure differ from traditional unlabeled
  174. resources by the fact that they do not take a `name` parameter at creation.
  175. These rules can be found within each Firewall (i.e. Security Group) in the
  176. Azure web portal, and will have an automatically generated `name` of the form
  177. 'cb-rule-[int]'.