Hello Gaurav Singh
Yes, you can set disk access for a snapshot using PowerShell. Here are the steps:
- Grant access to the disk:
$sas = Grant-AzDiskAccess -ResourceGroupName $rg -DiskName $diskName -DurationInSecond $sasExpiryDuration -Access Read
- Create a snapshot of the disk:
$snapshot = New-AzSnapshot -SourceUri $sas.AccessSAS -SnapshotName $snapshotName -ResourceGroupName $rg
- Revoke access to the disk:
Revoke-AzDiskAccess -ResourceGroupName $rg -DiskName $diskName
You can find more information about creating a managed disk from a snapshot with PowerShell in this Microsoft Learn article.