// Module included in the following assemblies:
//
// * storage/persistent_storage/persistent-storage-azure-file.adoc

:_mod-docs-content-type: PROCEDURE
[id="create-azure-file-secret_{context}"]
= Create the Azure File share persistent volume claim

[role="_abstract"]
To create the persistent volume claim, you must first define a `Secret` object that contains the Azure account and key. This secret is used in the `PersistentVolume` definition, and will be referenced by the persistent volume claim for use in applications.

.Prerequisites

* An Azure File share exists.
* The credentials to access this share, specifically the storage account and
key, are available.

.Procedure

. Create a `Secret` object that contains the Azure File credentials:
+
[source,terminal]
----
$ oc create secret generic __<secret-name>__ --from-literal=azurestorageaccountname=__<storage-account> --from-literal=azurestorageaccountkey=__<storage-account-key>
----
+
where:

`<secret-name>`:: Specifies the Azure File storage account name.
`<storage-account-key>`:: Specifies the Azure File storage account key.

. Create a `PersistentVolume` object that references the `Secret` object you created:
+
[source,yaml]
----
apiVersion: "v1"
kind: "PersistentVolume"
metadata:
  name: "pv0001"
spec:
  capacity:
    storage: "5Gi"
  accessModes:
    - "ReadWriteOnce"
  storageClassName: azure-file-sc
  azureFile:
    secretName: <secret-name>
    shareName: <share-name>
    readOnly: false
----
+
where:

`metadata.name`:: Specifies the name of the persistent volume.
`spec.capacity.storage`:: Specifies the size of this persistent volume, for example `5Gi`.
`spec.azureFile.secretName`:: Specifies the name of the secret that contains the Azure File share credentials.
`spec.azureFile.shareName`:: Specifies the name of the Azure File share.

. Create a `PersistentVolumeClaim` object that maps to the persistent volume you created:
+
[source,yaml]
----
apiVersion: "v1"
kind: "PersistentVolumeClaim"
metadata:
  name: "claim1"
spec:
  accessModes:
    - "ReadWriteOnce"
  resources:
    requests:
      storage: "5Gi"
  storageClassName: azure-file-sc
  volumeName: "pv0001"
----
+
where:

`metadata.name`:: Specifies the name of the persistent volume claim.
`spec.resources.requests.storage`:: Specifies the size of this persistent volume claim, for example `5Gi`.
`spec.storageClassName`:: Specifies the name of the existing `PersistentVolume` object that references the Azure File share. Specify the storage class used in the `PersistentVolume` definition.
 `spec.volumeName`:: Specifies the name of the existing `PersistentVolume` object that references the Azure File share.
