Azure / azure-libraries-for-net

Azure libraries for .Net
MIT License
377 stars 190 forks source link

[FEATURE REQ] Support Custom Cloud in Microsoft.Azure.Management.ResourceManager.Fluent.AzureEnvironment #1326

Open bganapa opened 1 year ago

bganapa commented 1 year ago

Is your feature request related to a problem? Please describe. Microsoft.Azure.Management.ResourceManager.Fluent.AzureEnvironment has defined a static list of known environments. This class is heavily used when initializing all resourcemanagement clients. This is making it difficult for other custom azure clouds like AzureStack.

Describe the solution you'd like Suggest adding a method in this class like GetAzureEnvironmentFromArmEndpoint We have a similar method in Go SDK - https://github.com/Azure/go-autorest/blob/711dde1b1be6e3a7da75975e08f64e0cafb905a3/autorest/azure/metadata_environment.go#L96

All the needed information to initalize the AzureEnvironment can be read from ARM metadata endpoint itself (the existign hardcoded values can be removed as well) e.g https://management.azure.com/metadata/endpoints?api-version=1.0 https://management.azure.com/metadata/endpoints?api-version=2019-10-01

Describe alternatives you've considered defining the method ourselves wherever the client needs to be initialized.

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report