I'm trying to list unused, unattached, and unassociated resources inside Azure using Azure CLI.
So far, I've got unmanaged disks using the command:
unmanagedDiskNames=$(az disk list -g $rgName --query "[?(managedBy==null)].name" -o tsv)
I've got unattached Network interfaces using the command:
unattachedNicsIds=$(az network nic list -g $rgName --query "[?(virtualMachine==null)].id" -o tsv)
I'm having issued listing Public IPs and Network security groups. Tried to get public IPs using the command (it not worked):
unassociated_publicIPs=$(az network public-ip list -g "Technology-RG" --query "[?(IpConfiguration==null)].id" -o tsv)
Can you help me get unassociated public IPs and NSGs? Thank you.