I need to programmatically get the access profile for an AKS cluster from Java. I see that the REST API to do this is documented here. Is this API exposed in the azure java sdk? If so where? If not, I would have to use an http client and add the Bearer token in the header. But, how could I use the azure sdk to programmatically get a Bearer token for a particular client id and client secret?
Not sure, maybe you can get AKS cluster access profile use the Java SDK userKubeConfigContent()
.
And you also can get the access token in the Java Code. See get the access token. And the code will like this:
// Request access token from AAD
AuthenticationResult result = getAccessTokenFromUserCredentials(
username, password);
// Get user info from Microsoft Graph
String userInfo = getUserInfoFromGraph(result.getAccessToken());
Hope this will help you.