RobustPerception / azure_metrics_exporter

Azure metrics exporter for Prometheus
Apache License 2.0
133 stars 69 forks source link

GOV endpoints #2

Open hoopty opened 6 years ago

hoopty commented 6 years ago

It would be ideal if endpoints could be overloaded for alternate Azure environments like Gov. I believe just the TLD changes to .us (instead of .com), but need to validate that. I'll try to work on a PR, but wanted to mention her as well.

asheniam commented 6 years ago

It's not just a change from .com to .us. You need to change the endpoints for both AAD and ARM. The below file has a mapping of these endpoints for each of the different Azure clouds. https://github.com/projectkudu/ARMClient/blob/master/ARMClient.Authentication/Constants.cs

I'd recommend exposing a new environment property under credentials section in the yaml which maps to Public, China, Germany, and USGov. Internally within the exporter, the code can look up the appropriate endpoint.

brian-brazil commented 6 years ago

Do Microsoft have a library for this?

asheniam commented 6 years ago

I don't know if there is an official library for this but in Azure PowerShell, there is a cmdlet called Get-AzureRmEnvironment which returns back the environment settings for each of the clouds. Looking at the PowerShell code, it maps back to this file -- which is probably more official than the link I posted above.

https://github.com/Azure/azure-powershell/blob/8bd4c84a1b51b86ffc2d8977d5dcc438df480afa/src/Common/Commands.Common.Authentication.Abstractions/AzureEnvironmentConstants.cs

brian-brazil commented 6 years ago

That's CSharp which won't help us much. Is there a java one somewhere?

asheniam commented 6 years ago

I checked the Azure SDK for Java but I didn't see anything. I would check with the folks here. https://github.com/Azure/azure-libraries-for-java