@@ -293,34 +293,6 @@ private static String discoverRegion(MsalRequest msalRequest, ServiceBundle serv
293293 return System .getenv (REGION_NAME );
294294 }
295295
296- // try {
297- // //Check the IMDS endpoint to retrieve current region (will only work if application is running in an Azure VM)
298- // Map<String, String> headers = new HashMap<>();
299- // headers.put("Metadata", "true");
300- // IHttpResponse httpResponse = executeRequest(IMDS_ENDPOINT, headers, msalRequest, serviceBundle);
301- //
302- // //If call to IMDS endpoint was successful, return region from response body
303- // if (httpResponse.statusCode() == HttpHelper.HTTP_STATUS_200 && !httpResponse.body().isEmpty()) {
304- // log.info(String.format("Region retrieved from IMDS endpoint: %s", httpResponse.body()));
305- // currentRequest.regionSource(RegionTelemetry.REGION_SOURCE_IMDS.telemetryValue);
306- //
307- // return httpResponse.body();
308- // }
309- //
310- // log.warn(String.format("Call to local IMDS failed with status code: %s, or response was empty", httpResponse.statusCode()));
311- // currentRequest.regionSource(RegionTelemetry.REGION_SOURCE_FAILED_AUTODETECT.telemetryValue);
312- //
313- // return null;
314- // } catch (Exception e) {
315- // //IMDS call failed, cannot find region
316- // //The IMDS endpoint is only available from within an Azure environment, so the most common cause of this
317- // // exception will likely be java.net.SocketException: Network is unreachable: connect
318- // log.warn(String.format("Exception during call to local IMDS endpoint: %s", e.getMessage()));
319- // currentRequest.regionSource(RegionTelemetry.REGION_SOURCE_FAILED_AUTODETECT.telemetryValue);
320- //
321- // return null;
322- // }
323-
324296 //Check the IMDS endpoint to retrieve current region (will only work if application is running in an Azure VM)
325297 Map <String , String > headers = new HashMap <>();
326298 headers .put ("Metadata" , "true" );
0 commit comments