Hi Michael Malinowski,
Welcome to the Microsoft Q&A Platform! Thank you for asking your question here
Based on your query,
Could you please try below script to remove plan and attach the certain disk I have tested in my lab it is working as expected Please try and let me know If you have already existing disk, you ignore that disk creation command only you can replace names and run the script in PowerShell
# Create the Disk Configuration
$diskConfig = New-AzDiskConfig -SkuName StandardSSD_LRS -Location "EastUS" -CreateOption Empty -DiskSizeGB 128
# Create the Disk in the 'Akshay' resource group
$disk = New-AzDisk -ResourceGroupName Akshay -DiskName akshaydisk123 -Disk $diskConfig
# Get the VM Information
$vm = Get-AzVM -ResourceGroupName Akshay -Name pcsvm
# Remove the Plan Information
$vm.Plan = $null
# Update the VM
Update-AzVM -ResourceGroupName Akshay -VM $vm
# Verify the Changes
$vm = Get-AzVM -ResourceGroupName Akshay -Name pcsvm
$vm | Format-List
# Attach the New Disk to the VM
# Get the Disk and VM Info
$disk = Get-AzDisk -ResourceGroupName Akshay -DiskName akshaydisk123
$vm = Get-AzVM -ResourceGroupName Akshay -Name pcsvm
# Attach the Disk to the VM
$vm.StorageProfile.DataDisks.Add([Microsoft.Azure.Management.Compute.Models.DataDisk]@{
Lun = 0
Name = $disk.Name
CreateOption = "Attach"
ManagedDisk = @{ Id = $disk.Id }
})
# Update the VM with the new disk
Update-AzVM -ResourceGroupName Akshay -VM $vm
# Verify Disk Attachment
$vm = Get-AzVM -ResourceGroupName Akshay -Name pcsvm
$vm.StorageProfile.DataDisks | Format-List
# Get the VM Info
$vm = Get-AzVM -ResourceGroupName Akshay -Name pcsvm
# Identify the disk (assuming Lun = 0)
$dataDisk = $vm.StorageProfile.DataDisks | Where-Object { $_.Lun -eq 0 }
# Remove the disk from the VM
$vm.StorageProfile.DataDisks.Remove($dataDisk)
# Update the VM
Update-AzVM -ResourceGroupName Akshay -VM $vm
# to verify detachment
$vm = Get-AzVM -ResourceGroupName Akshay -Name pcsvm
$vm.StorageProfile.DataDisks | Format-List
And also review the below link it is related same kind of question will be there it might help any one of the inputs
https://learn.microsoft.com/en-us/answers/questions/359145/how-to-fix-a-generalized-vm-that-requires-plan-inf
Please let me know if you have any further questions Tag me in a comment, and I will be happy to help. Feel free to ask if you need any additional information. I am always here to assist you as needed.
If you found this information helpful, please click an accepting the answer and 👍"Upvote" on my post for other community member's reference