|
| 1 | +// Module included in the following assemblies: |
| 2 | + |
| 3 | +// * backup_and_restore/application_backup_and_restore/installing/installing-oadp-azure.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="oadp-auth-azure-secret-based_{context}"] |
| 7 | += Using a service principal or a storage account access key |
| 8 | + |
| 9 | +[role="_abstract"] |
| 10 | +You create a default `Secret` object and reference it in the backup storage location custom resource. The credentials file for the `Secret` object can contain information about the Azure service principal or a storage account access key. |
| 11 | + |
| 12 | +The default name of the `Secret` is `{credentials}`. |
| 13 | + |
| 14 | +[NOTE] |
| 15 | +==== |
| 16 | +The `DataProtectionApplication` custom resource (CR) requires a default `Secret`. Otherwise, the installation will fail. If the name of the backup location `Secret` is not specified, the default name is used. |
| 17 | +
|
| 18 | +If you do not want to use the backup location credentials during the installation, you can create a `Secret` with the default name by using an empty `credentials-velero` file. |
| 19 | +==== |
| 20 | + |
| 21 | + |
| 22 | +.Prerequisites |
| 23 | + |
| 24 | +* You have access to the OpenShift cluster as a user with `cluster-admin` privileges. |
| 25 | +* You have an Azure subscription with appropriate permissions. |
| 26 | +* You have installed {oadp-short}. |
| 27 | +* You have configured an object storage for storing the backups. |
| 28 | +
|
| 29 | +.Procedure |
| 30 | + |
| 31 | +. Create a `credentials-velero` file for the backup storage location in the appropriate format for your cloud provider. |
| 32 | ++ |
| 33 | +You can use one of the following two methods to authenticate {oadp-short} with Azure. |
| 34 | + |
| 35 | +* Use the service principal with secret-based authentication. See the following example: |
| 36 | ++ |
| 37 | +[source,terminal] |
| 38 | +---- |
| 39 | +AZURE_SUBSCRIPTION_ID=<azure_subscription_id> |
| 40 | +AZURE_TENANT_ID=<azure_tenant_id> |
| 41 | +AZURE_CLIENT_ID=<azure_client_id> |
| 42 | +AZURE_CLIENT_SECRET=<azure_client_secret> |
| 43 | +AZURE_RESOURCE_GROUP=<azure_resource_group> |
| 44 | +AZURE_CLOUD_NAME=<azure_cloud_name> |
| 45 | +---- |
| 46 | +
|
| 47 | +* Use a storage account access key. See the following example: |
| 48 | ++ |
| 49 | +[source,terminal] |
| 50 | +---- |
| 51 | +AZURE_STORAGE_ACCOUNT_ACCESS_KEY=<azure_storage_account_access_key> |
| 52 | +AZURE_SUBSCRIPTION_ID=<azure_subscription_id> |
| 53 | +AZURE_RESOURCE_GROUP=<azure_resource_group> |
| 54 | +AZURE_CLOUD_NAME=<azure_cloud_name> |
| 55 | +---- |
| 56 | +
|
| 57 | +. Create a `Secret` custom resource (CR) with the default name: |
| 58 | ++ |
| 59 | +[source,terminal,subs="attributes+"] |
| 60 | +---- |
| 61 | +$ oc create secret generic {credentials} -n openshift-adp --from-file cloud=credentials-velero |
| 62 | +---- |
| 63 | + |
| 64 | +. Reference the `Secret` in the `spec.backupLocations.velero.credential` block of the `DataProtectionApplication` CR when you install the Data Protection Application as shown in the following example: |
| 65 | ++ |
| 66 | +[source,yaml,subs="attributes+"] |
| 67 | +---- |
| 68 | +apiVersion: oadp.openshift.io/v1alpha1 |
| 69 | +kind: DataProtectionApplication |
| 70 | +metadata: |
| 71 | + name: <dpa_sample> |
| 72 | + namespace: openshift-adp |
| 73 | +spec: |
| 74 | +... |
| 75 | + backupLocations: |
| 76 | + - velero: |
| 77 | + config: |
| 78 | + resourceGroup: <azure_resource_group> |
| 79 | + storageAccount: <azure_storage_account_id> |
| 80 | + subscriptionId: <azure_subscription_id> |
| 81 | + credential: |
| 82 | + key: cloud |
| 83 | + name: <custom_secret> # <1> |
| 84 | + provider: azure |
| 85 | + default: true |
| 86 | + objectStorage: |
| 87 | + bucket: <bucket_name> |
| 88 | + prefix: <prefix> |
| 89 | + snapshotLocations: |
| 90 | + - velero: |
| 91 | + config: |
| 92 | + resourceGroup: <azure_resource_group> |
| 93 | + subscriptionId: <azure_subscription_id> |
| 94 | + incremental: "true" |
| 95 | + provider: {provider} |
| 96 | +---- |
| 97 | +<1> Backup location `Secret` with custom name. |
0 commit comments