<p>I've been battling this error for a few hours now. Found several articles but nothing that has helped so far.</p>
<p>My work has been based on the &quot;How-to guide &gt; Configure data volumes &gt; Azure Disk - Static&quot; from <a href="https://learn.microsoft.com/en-us/azure/aks/azure-disk-volume" rel="noreferrer">https://learn.microsoft.com/en-us/azure/aks/azure-disk-volume</a>. As far as I can tell, I've not missed any steps.</p>
<p>I have defined by config in a YAML file as so:</p>
<pre>kind: Deployment
metadata:
    name: phio-dep-db
    namespace: production
spec:
    selector:
        matchLabels:
            app: phio
    replicas: 1
    strategy:
        type: RollingUpdate
    template:
        metadata:
            labels:
                app: phio
        spec:
            terminationGracePeriodSeconds: 1
            volumes:
              - name: dbvolume
                azureDisk:
                    diskName: PHIO_DB_VOL
                    diskURI: /subscriptions/&lt;my-sub-id/resourceGroups/&lt;my-grp&gt;/providers/Microsoft.Compute/disks/PHIO_DB_VOL
                    kind: Managed
            containers:
              - image: phioweb.azurecr.io/phiodb
                name: db
                ports:
                  - containerPort: 3306
                volumeMounts:
                  - mountPath: /var/lib/mysql
                    name: dbvolume
</pre>
<p>However, when I do kubectl apply -f .yml, the pod never starts. If I do a &quot;kubectl describe all -n production&quot; I see the following:</p>
<pre>  Type     Reason              Age                 From                                        Message
  ----     ------              ----                ----                                        -------
  Normal   Scheduled           31m                 default-scheduler                           Successfully assigned production/phio-dep-db-6c6ddc885-p4ntg to aks-nodepool1-18816840-vmss000001
  Warning  FailedAttachVolume  79s (x23 over 31m)  attachdetach-controller                     AttachVolume.Attach failed for volume &quot;dbvolume&quot; : compute.DisksClient#Get: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: Service returned an error. Status=403 Code=&quot;AuthorizationFailed&quot; Message=&quot;The client '&lt;GUID&gt;' with object id '&lt;same GUID&gt;' does not have authorization to perform action 'Microsoft.Compute/disks/read' over scope '/subscriptions/&lt;my-sub-id/resourceGroups/&lt;my-grp&gt;/providers/Microsoft.Compute/disks/PHIO_DB_VOL' or the scope is invalid. If access was recently granted, please refresh your credentials.&quot;
  Warning  FailedMount         23s (x14 over 29m)  kubelet, aks-nodepool1-18816840-vmss000001  Unable to mount volumes for pod &quot;phio-dep-db-6c6ddc885-p4ntg_production(0e326781-2936-4451-9446-9608a8f41439)&quot;: timeout expired waiting for volumes to attach or mount for pod &quot;production&quot;/&quot;phio-dep-db-6c6ddc885-p4ntg&quot;. list of unmounted volumes=[dbvolume]. list of unattached volumes=[dbvolume default-token-s7svk]
</pre>
<p>There is nothing in the MS documentation about assigning permissions to the Azure Disk, and there are no apparent parameters I'm missing in the YAML.</p>
<p>Anyone got any ideas what I'm missing?</p>
<p>Many thanks.</p>
<p>(I've sanitized the output a little, but it's all test and the Azure subscription will be binned after this work, even though it says production)</p>

<p>From the docs <a href="https://learn.microsoft.com/en-us/azure/aks/azure-disk-volume#create-an-azure-disk" rel="nofollow noreferrer">here</a></p>
<blockquote>
<p>When you create an Azure disk for use with AKS, <strong>you can create the disk resource in the node resource group</strong>. This approach allows the AKS cluster to access and manage the disk resource.If you instead create the disk in a separate resource group, you must
grant the Azure Kubernetes Service (AKS) service principal for your
cluster the Contributor role to the disk's resource group.
Alternatively, you can use the system assigned managed identity for
permissions instead of the service principal. For more information,
see <a href="https://learn.microsoft.com/en-us/azure/aks/use-managed-identity" rel="nofollow noreferrer">Use managed identities</a></p>
</blockquote>
<p>From the docs <a href="https://learn.microsoft.com/en-us/azure/aks/kubernetes-service-principal" rel="nofollow noreferrer">here</a></p>
<p>You may need to access existing Disk resources in another resource group. Assign one of the following set of role permissions:</p>
<ol>
<li>Create a custom role and define the following role permissions:
Microsoft.Compute/disks/read
Microsoft.Compute/disks/write</li>
<li>Or, assign the Storage Account Contributor built-in role on the resource group</li>
</ol>
