I am studying the azure java sdk and I did not find a wrapper method for
az account get-access-token --resource api://xxxxx.microsoft.com/YYYY/ZZZZ
This request works properly from windows batch but i cannot run using azure java sdk. I'll appreciate any feedback about how to run this command using azure java sdk
Best Regards, Aurelian
You can use the below java spring-boot code to retrieve the access token and it worked for me as follows.
RestApiController.javaReplace
CLIENT_ID, CLIENT_SECRET & TENANT_IDin the above java code before executing it.To build the program, use below commands in the IDE terminal.
Token generated at
localhost:8080/gettokensuccessfully.