Auto assigned nodeId for azure spring app or how to get app instance name

Maciej Bąk 46 Reputation points
2023-01-10T09:31:30.63+00:00

Hi,

In azure spring boot app while having multiple instances I need to get somehow its app instance name, or would be perfect to configure nodeId generation ( int/long type , but if now I can live with name ). Anyone knows how to access this data from code ?

Azure Spring Apps
Azure Spring Apps
An Azure platform as a service for running Spring Boot applications at cloud scale. Previously known as Azure Spring Cloud.
61 questions
{count} votes

Accepted answer
  1. MuthuKumaran Murugaachari 6,246 Reputation points
    2023-01-12T19:29:47.3433333+00:00

    @Maciej Bąk Thank you for reaching out to Microsoft Q&A. I assume you are using Azure Spring Apps and looking to get instance name, you can follow the below docs:

    REST API: [Services - List][1]: Get list of service instances under resource group. [Apps - List][2]: Get list of app instances under service name including app instance name.

    PowerShell: Get-AzSpringCloud: Get list of service instances under resource group. Get-AzSpringCloudApp: Get list of app instances under service name including app instance name.

    Update:
    For Java SDK, you can use azure-resourcemanager library and Manage Spring Cloud sample listed here would help with few other scenarios. To list all spring apps under a spring service, use the below code snippet:

    List<SpringApp> springApps = springService.apps().list().stream().toList();
    

    I hope this helps with your question, and feel free to add a comment for questions. Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community.


1 additional answer

Sort by: Most helpful
  1. Maciej Bąk 46 Reputation points
    2023-01-18T12:58:55.5633333+00:00

    ok hostname from env is fine,thanks

    No comments