<p>I am trying to use storageclass, PersistentVolumeClaim ,PersistentVolume
I can run by command promt from local and working fine
But when deploying by azure pipeline getting issue
&quot;cannot get resource &quot;storageclasses&quot; in API group &quot;storage.k8s.io&quot; at the cluster scope&quot;</p>
<p><a href="https://i.stack.imgur.com/3J9X8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3J9X8.png" alt="enter image description here" /></a></p>
<pre><code> kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: azurefile
provisioner: kubernetes.io/azure-file
mountOptions:
  - dir_mode=0777
  - file_mode=0777
parameters:
  storageAccount: xxxdevxxx
  location: Souxxxxst xxxxx

---
# Create a Secret to hold the name and key of the Storage Account
# Remember: values are base64 encoded
apiVersion: v1
kind: Secret
metadata:
  name: azurefile-secret
type: Opaque
data:
  azurestorageaccountname: YWlhZ7xxxxxzdA==
  azurestorageaccountkey: a2s4bURfghfhjxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxMUd6eE1UTEdxZHdRUzhvR09UZ0xBempPN3dXZEF0K1E9PQ==

---
# Create a persistent volume, with the corresponding StorageClass and the reference to the Azure File secret.
# Remember: Create the share in the storage account otherwise the pods will fail with a &quot;No such file or directory&quot;
apiVersion: v1
kind: PersistentVolume
metadata:
  name: jee-pv
spec:
  capacity:
    storage: 5Gi
  accessModes:
  - ReadWriteOnce
  storageClassName: azurefile
  azureFile:
    secretName: azurefile-secret
    shareName: jee-log
    readOnly: false
  mountOptions:
  - dir_mode=0777
  - file_mode=0777
  - uid=1000
  - gid=1000

---
# Create a PersistentVolumeClaim referencing the StorageClass and the volume
# Remember: this is a static scenario. The volume was created in the previous step.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: jee-pvc
spec:
  accessModes:
    - ReadWriteOnce  
  resources:
    requests:
      storage: 5Gi
  storageClassName: azurefile-xxxx
  volumeName: jee-pv
</code></pre>

Jeebendu kumar Behera
<p>in Azurepipeline to create persistance volume and storage class by Kubernetes
use <strong>Service connection type</strong> = <strong>Azure Resource Manager</strong> instead of <strong>Azure service connection</strong></p>
