procuring_credentials.rst 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. Procuring access credentials
  2. ----------------------------
  3. To initialize a connection to a cloud and get a provider object, you will
  4. need to provide the cloud's access credentials to CloudBridge. This page
  5. will walk you through the process of procuring credentials. For more
  6. information on providing these credentials to CloudBridge, see
  7. `Providing Access Credentials <setup.html>`_.
  8. .. _azure-creds:
  9. Microsoft Azure
  10. ~~~~~~~~~~~~~~~
  11. The page linked below from the Microsoft Documentation was used to create this
  12. section, and can be followed instead of this CloudBridge-specific documentation
  13. to procure Azure credentials for other purposes.
  14. https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal
  15. In order to follow the isntructions below, one needs a Microsoft Azure
  16. account and Subscription, as well as portal access.
  17. The following section will walk you through the process of creating an
  18. application, which is required for API access, as well as help you locate
  19. all required Azure credentials for CloudBridge.
  20. Azure credentials require a `Subscription ID` which can be procured through
  21. `Subscriptions` in the Azure portal.
  22. .. figure:: captures/az-sub-1.png
  23. :alt: Azure Subscriptions 1
  24. Subscriptions can be accessed by searching, or by choosing `Subscriptions`
  25. in the `All Services` window
  26. .. figure:: captures/az-sub-2.png
  27. :alt: Azure Subscriptions 2
  28. The `Subscription ID` will be found in the list of subscriptions
  29. Another piece of credentials that already exists on any Azure account is a
  30. `Tenant ID` which will correspond to the `Active Directory ID`, which can be
  31. procured through the Azure Active Directory's `Properties`.
  32. .. figure:: captures/az-dir-1.png
  33. :alt: Azure Directory 1
  34. The `Azure Active Directory` can be access by searching, or by choosing
  35. `Azure Active Directory` in the `All Services` window. `Azure Active
  36. Directory` is also a default favorite on the sidebar
  37. .. figure:: captures/az-dir-2.png
  38. :alt: Azure Directory 2
  39. The `Directory ID` will be found in the Directory's `Properties` section
  40. In order to access the API, an application needs to be registered and a key
  41. needs to be created. After creating an application through the
  42. `App Registrations` window under the `Active Directory`, the `Application
  43. ID` of the app will correspond to the `Client ID` in CloudBridge, and the
  44. generated value of its key, will correspond to the `Secret`.
  45. .. figure:: captures/az-app-1.png
  46. :alt: Azure App 1
  47. `App Registrations` can be access by searching, or through choosing `App
  48. Registrations` under `Azure Active Directory`
  49. .. figure:: captures/az-app-2.png
  50. :alt: Azure App 2
  51. The `New Application Registration` button will allow users to create a
  52. new application
  53. .. figure:: captures/az-app-3.png
  54. :alt: Azure App 3
  55. The `Name` has to be unique within the subscription and will be used to
  56. identify the `Application` later on. The `Sign-on URL` can be any
  57. URL-looking string. It does not have to point towards anything.
  58. .. figure:: captures/az-app-4.png
  59. :alt: Azure App 4
  60. After creating the application, one must select it, after which the
  61. `Application ID` will map to the `Client ID` in CloudBridge
  62. .. figure:: captures/az-app-5.png
  63. :alt: Azure App 5
  64. In the application's `Settings` panel, under the `Keys` section, one will
  65. be able to create a new `Secret`
  66. .. figure:: captures/az-app-6.png
  67. :alt: Azure App 6
  68. Any name can be given to the key, and any expiration date, after which
  69. the `Save` button will generate the `Key` which will correspond to the
  70. `Secret` in CloudBridge
  71. .. figure:: captures/az-app-7.png
  72. :alt: Azure App 7
  73. The value of the key will correspond to the `Secret` in CloudBridge and
  74. needs to be saved at creation-time
  75. Finally, in order to have appropriate permissions, you must assign an
  76. appropriate role to the newly created application. Permissions can be
  77. assigned at the level of the Subscription, or at the level of each Resource
  78. Group. `Contributor` access is recommended for general use in order to have
  79. sufficient permissions to create and manage all types of resources, but
  80. specific roles can also be assigned for more limited access.
  81. .. figure:: captures/az-role-1.png
  82. :alt: Azure Roles 1
  83. Subscription-level access will allow the application to access resources
  84. from multiple resource groups
  85. .. figure:: captures/az-role-2.png
  86. :alt: Azure Roles 2
  87. When roles are set at the level of the Resource Group, one must specify
  88. this Resource Group as part of the credentials, as the application will
  89. not have enough permissions to create a Resource Group
  90. .. figure:: captures/az-role-3.png
  91. :alt: Azure Roles 3
  92. Adding a role assignment to the application will give it appropriate
  93. permissions to manage resources
  94. .. _google-creds:
  95. Google Compute Engine
  96. ~~~~~~~~~~~~~~~~~~~~~
  97. For Google Compute Engine, create a service account following instructions
  98. from the link below:
  99. https://cloud.google.com/iam/docs/creating-managing-service-accounts#creating_a_service_account
  100. Once created, grant the account appropriate permissions for your use through
  101. roles, and create a key, choosing JSON format, when prompted. These
  102. credentials can then be used with CloudBridge through the variables shown
  103. in the sections below.
  104. The JSON credentials file will have a similar form to the example shown
  105. below, and can either be passed through an absolute path to the file, or
  106. through a variable containing the JSON dictionary itself.
  107. .. code-block:: json
  108. {
  109. "type": "service_account",
  110. "project_id": "my-project",
  111. "private_key_id": "b12321312441245gerg245245g42c245g254t425",
  112. "private_key": "-----BEGIN PRIVATE KEY-----\nMIICWgIBAAKBgE1EJDPKM/2wck/CZYCS7F2cXoHXDBhXYtdeV+h70Nk+ABs6scAV\nApYoobJAVpDeL+lutYAwtbscNz5K915DiNEkBf48LhfBWc5ea07OnClOGC9zASja\nif6ujIdhbITaNat9rdG939gQWqyaDW4wzYfvurhfmxICNgZA1YpWco1HAgMBAAEC\ngYAc+vLtLelEPNsTSWGS0Qiwr8bOwl75/kTHbM5iF5ak9NlLXT9wQTEgKwtC9VjC\nq2OjFXAkLaDsFlAuICYaCBCXn1nUqNoYhaSEQNwGnWIz376letXg/mX+BALSPMFR\nhE6mbdmaL4OV1X8j8uf2VcrLfVFCCZfhPu/TM5D6bVFYoQJBAJRHNKYU/csAB/NE\nzScJBv7PltOAoYpxbyFZb1rWcV9mAn34382b0YBXbp3Giqvifs/teudUbRpAzzLm\n5gr8tzECQQCFZh4tNIzeZZYUqkQxrxgqnnONey1hX7K+BlGyC6n2o26sE+I7cLij\n2kbuWoSFMAIdM2Hextv9k+ZrwUas4V33AkAfi9Korvib0sLeP7oB3wrM9W9aShiU\nMrP4/WUSh2MRb8uB74v123vD+VYAXTgtf3+JTzYBt1WK61TpuHQizEdRAkBjt8hL\nBoNfJBUicXz0nuyzvyql0jREG+NjhRnAvFNbGSR74Yk14bdEVMC9IFD7tr190pEQ\nlRqR3eNbHWmVhgpVAkBgveeM73R1tFXS6UosBtfDI1zut44Ce0RoADOIxjXqgjOi\nXSrevYvoKCl09yhLNAnKD+QvT/YbshW/jibYXwdj\n-----END PRIVATE KEY-----",
  113. "client_email": "service-name@my-project.iam.gserviceaccount.com",
  114. "client_id": "13451345134513451345",
  115. "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  116. "token_uri": "https://oauth2.googleapis.com/token",
  117. "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  118. "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/service-name%40my-project.iam.gserviceaccount.com"
  119. }