Hi Diptesh Kumar
As per discussion in private message,

Let me Clarify each one of your questions:
Will software on D: be embedded into the image?
- No, the D: drive itself will not be embedded into the container image. If you're mounting D: as a volume (-v D:\agentdata:C:\persistent), the software installed on D: will reside on the host, not inside the container image.
Will D: remain intact and usable when the image is deployed in Kubernetes (AKS)?
- Not automatically. Kubernetes doesn’t know about subst or drive letters
- When deploying to AKS, the container image itself will be immutable. Since D: is being mapped dynamically, it won't exist inside the Kubernetes pod unless explicitly configured. You will need to use persistent storage like PVC's - Persistent Volume Claims.
Can this setup remain consistent across AKS deployments?
- Yes, but only if you use a Persistent Volume (PV).
If the goal is to keep software installed on D: store it in an Azure Files share.
For this Go to Azure Portal -> Create an Azure Storage Account -> Then Navigate to File Shares and Create it. Now, you’ll map D: inside your Windows container using the SMB protocol.
Inside Storage Account, go to Access Keys and copy the key and then go to your File Share and Connect via SMB. Copy the provided net use command.
Now Inside the Windows container, run:
net use D: \\mywindowsagentstorage.file.core.windows.net\persistent-agent-share /user:mywindowsagentstorage xxxxxxxxxxxx==
This mounts D: inside the container and persists software installed there.
In AKS, ensure the drive remains consistent. Define PersistentVolume
apiVersion: v1
kind: PersistentVolume
metadata:
name: azure-file-pv
spec:
capacity:
storage: 100Gi
accessModes:
- ReadWriteMany
azureFile:
secretName: azure-secret
shareName: persistent-agent-share
storageAccountName: mywindowsagentstorage #your storage account name
In your Kubernetes manifest, Create PVC:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: azure-file-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100Gi
volumeName: azure-file-pv
Mount it inside the pod:
containers:
- name: windows-agent-container
image: my-agent-image
volumeMounts:
- name: azure-storage
mountPath: /persistent
volumes:
- name: azure-storage
persistentVolumeClaim:
claimName: azure-file-pvc
Inside the container, run: subst D: C:\persistent
This ensures D: drive remains accessible.
Another approach you can try to use an init container in Kubernetes to restore the D: drive mapping before the main workload runs.
Hope this helps!
Please Let me know if you have any queries.
If you found the information helpful, please click "Upvote" on the post to let us know and consider accepting the answer as the token of appreciation. Thank You.