2
0

azure_mapping.rst 13 KB

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