@Dnyaneshwar Surywanshi Thank you for reaching out.
We sincerely apologize for the delay in getting back to you.
You can use IpConfiguration property to check if the IP is already associated with any other resource.
var publicip1 = await azure.PublicIPAddresses.GetByIdAsync("/subscriptions/XXXXX-c5b6-44fb-b5ba-XXXXX/resourceGroups/XXXX-testing/providers/Microsoft.Network/publicIPAddresses/pip1-intlb1-22899143b");
if (publicip1.Inner.IpConfiguration == null)
{
Console.WriteLine("IP Address is not associated");
}
else
{
Console.WriteLine("IP Address is already associated");
}
Please let us know if you have any further questions.
----------
If an answer is helpful, please "Accept answer" or "Up-Vote" for the same which might be beneficial to other community members reading this thread.