azure_mapping.rst 14 KB

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