This script helps to clean up vmss nodes that may have Azure disks attached to it that should not be due to bugs in Kubernetes. The specific case for this is that a disk has been re-attached to by Kubernetes when it should not have been.
This DOES NOT detect a bad node/disk, only assists in cleaning it up.
$ ./vmssfix.sh NODE_NAME PV_NAME
Where Node_NAME is the AKS Node name and PV_NAME is the Name of the PV having issues (normally from the logs).
This will trigger a detach of the pvc from the vmss instance in Azure. It will not perform any destructive action without user confirmation. You can run the script from any machine, including your local machine, that has the azure CLI installed and logged in.