procuring_credentials.rst 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. **Microsoft Azure**
  9. For Microsoft Azure, the link below shows how to create service principle
  10. credentials:
  11. https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal
  12. After having a Microsoft Azure account, in order to have API access,
  13. application credentials are needed. The following section will walk you
  14. through the process of creating and/or locating all required credentials.
  15. Azure credentials require a `Subscription ID` which can be procured through
  16. `Subscriptions` in the Azure portal.
  17. .. figure:: captures/az-sub-1.png
  18. :alt: Azure Subscriptions 1
  19. Subscriptions can be accessed by searching, or by choosing `Subscriptions`
  20. in the `All Services` window
  21. .. figure:: captures/az-sub-2.png
  22. :alt: Azure Subscriptions 2
  23. The `Subscription ID` will be found in the list of subscriptions
  24. Another piece of credentials that already exists on any Azure account is a
  25. `Tenant ID` which will correspond to the `Active Directory ID`, which can be
  26. procured through the Azure Active Directory's `Properties`.
  27. .. figure:: captures/az-dir-1.png
  28. :alt: Azure Directory 1
  29. The `Azure Active Directory` can be access by searching, or by choosing
  30. `Azure Active Directory` in the `All Services` window. `Azure Active
  31. Directory` is also a default favorite on the sidebar
  32. .. figure:: captures/az-dir-2.png
  33. :alt: Azure Directory 2
  34. The `Directory ID` will be found in the Directory's `Properties` section
  35. In order to access the API, an application needs to be registered and a key
  36. needs to be created. After creating an application through the
  37. `App Registrations` window under the `Active Directory`, the `Application
  38. ID` of the app will correspond to the `Client ID` in CloudBridge, and the
  39. generated value of its key, will correspond to the `Secret`.
  40. .. figure:: captures/az-app-1.png
  41. :alt: Azure App 1
  42. `App Registrations` can be access by searching, or through choosing `App
  43. Registrations` under `Azure Active Directory`
  44. .. figure:: captures/az-app-2.png
  45. :alt: Azure App 2
  46. The `New Application Registration` button will allow users to create a
  47. new application
  48. .. figure:: captures/az-app-3.png
  49. :alt: Azure App 3
  50. The `Name` has to be unique within the subscription and will be used to
  51. identify the `Application` later on. The `Sign-on URL` can be any
  52. URL-looking string. It does not have to point towards anything.
  53. .. figure:: captures/az-app-4.png
  54. :alt: Azure App 4
  55. After creating the application, one must select it, after which the
  56. `Application ID` will map to the `Client ID` in CloudBridge
  57. .. figure:: captures/az-app-5.png
  58. :alt: Azure App 5
  59. In the application's `Settings` panel, under the `Keys` section, one will
  60. be able to create a new `Secret`
  61. .. figure:: captures/az-app-6.png
  62. :alt: Azure App 6
  63. Any name can be given to the key, and any expiration date, after which
  64. the `Save` button will generate the `Key` which will correspond to the
  65. `Secret` in CloudBridge
  66. .. figure:: captures/az-app-7.png
  67. :alt: Azure App 7
  68. The value of the key will correspond to the `Secret` in CloudBridge and
  69. needs to be saved at creation-time
  70. Finally, in order to have appropriate permissions, you must assign an
  71. appropriate role to the newly created application. Permissions can be
  72. assigned at the level of the Subscription, or at the level of each Resource
  73. Group. `Contributor` access is recommended for general use in order to have
  74. sufficient permissions to create and manage all types of resources, but
  75. specific roles can also be assigned for more limited access.
  76. .. figure:: captures/az-role-1.png
  77. :alt: Azure Roles 1
  78. Subscription-level access will allow the application to access resources
  79. from multiple resource groups
  80. .. figure:: captures/az-role-2.png
  81. :alt: Azure Roles 2
  82. When roles are set at the level of the Resource Group, one must specify
  83. this Resource Group as part of the credentials, as the application will
  84. not have enough permissions to create a Resource Group
  85. .. figure:: captures/az-role-3.png
  86. :alt: Azure Roles 3
  87. Adding a role assignment to the application will give it appropriate
  88. permissions to manage resources
  89. **Google**
  90. For Google Compute Engine, create a service account following instructions
  91. from the link below:
  92. https://cloud.google.com/iam/docs/creating-managing-service-accounts#creating_a_service_account
  93. Once created, grant the account appropriate permissions for your use through
  94. roles, and create a key, choosing JSON format, when prompted. These
  95. credentials can then be used with CloudBridge through the variables shown
  96. in the sections below.
  97. The JSON credentials file will have a similar form to the example shown
  98. below, and can either be passed through an absolute path to the file, or
  99. through a variable containing the JSON dictionary itself.
  100. .. code-block:: json
  101. {
  102. "type": "service_account",
  103. "project_id": "my-project",
  104. "private_key_id": "b12321312441245gerg245245g42c245g254t425",
  105. "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-----",
  106. "client_email": "service-name@my-project.iam.gserviceaccount.com",
  107. "client_id": "13451345134513451345",
  108. "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  109. "token_uri": "https://oauth2.googleapis.com/token",
  110. "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  111. "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/service-name%40my-project.iam.gserviceaccount.com"
  112. }