Hi @Nana Poku,
Welcome to Microsoft Q&A Forum, thank you for posting your query here!
Instead of using an Azure policy use Azure Automation account and schdule this job when ver it is required
Can you use an automation Account and create a run book. This is very easy to use.
Below script will do the job
$disks = Get-AzDisk | Where-Object {$_.PublicNetworkAccess -eq 'Enabled'}
foreach ($disk in $disks) {$disk | New-AzDiskUpdateConfig -PublicNetworkAccess "Disabled" -NetworkAccessPolicy "DenyAll" | Update-AzDisk -resourcegroup $($disk.resourcegroupname) -diskname $($disk.name)}
Below is the artifact of the output:-
Feel free to reach out if you have any further questions or need additional information—I’m happy to assist!
Please provide your valuable comments
Please do not forget to "Accept the answer” and “upvote it” wherever the information provided helps you, this can be beneficial to other community members.it would be greatly appreciated and helpful to others.