Thank you again, @Udayakumar Iyappan !
I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! I've upvoted your answer but since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.
Answer provided by @Udayakumar Iyappan:
Thanks for the Info @kobulloc-MSFT . I am able to retrieve the public ips of uniform vmss using the below python code.
from azure.identity import DefaultAzureCredential
from azure.mgmt.network import NetworkManagementClient
def get_vmss_public_ips(subscription_id,resource_group_name,vmss_name):
credential = DefaultAzureCredential()
network_client = NetworkManagementClient(credential, subscription_id,api_version="2023-09-01")
public_ip_address = network_client.public_ip_addresses.list_virtual_machine_scale_set_public_ip_addresses(
resource_group_name, vmss_name
)
public_ips=[]
for ip in public_ip_address:
public_ips.append(ip.ip_address)
logger.info("Public IPs: %s" % public_ips)
return public_ips