2
0

azure_mapping.rst 14 KB

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