Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure App Service is not correctly detected on Windows #27819

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -140,12 +140,17 @@ private boolean isAutoDetected(EnumerablePropertySource<?> environmentPropertySo

private static final String WEBSITE_SITE_NAME = "WEBSITE_SITE_NAME";

private static final String WEBSITES_ENABLE_APP_SERVICE_STORAGE = "WEBSITES_ENABLE_APP_SERVICE_STORAGE";
private static final String WEBSITE_INSTANCE_ID = "WEBSITE_INSTANCE_ID";

private static final String WEBSITE_RESOURCE_GROUP = "WEBSITE_RESOURCE_GROUP";

private static final String WEBSITE_SKU = "WEBSITE_SKU";

@Override
public boolean isDetected(Environment environment) {
return environment.containsProperty(WEBSITE_SITE_NAME)
&& environment.containsProperty(WEBSITES_ENABLE_APP_SERVICE_STORAGE);
return environment.containsProperty(WEBSITE_SITE_NAME) && environment.containsProperty(WEBSITE_INSTANCE_ID)
&& environment.containsProperty(WEBSITE_RESOURCE_GROUP)
&& environment.containsProperty(WEBSITE_SKU);
}

};
Expand Down
Expand Up @@ -136,7 +136,9 @@ void getActiveWhenHasServiceHostAndNoServicePortShouldNotReturnKubernetes() {
void getActiveWhenHasWebsiteSiteNameAndWebsitesEnableAppServiceStorageShouldReturnAzureAppService() {
Map<String, Object> envVars = new HashMap<>();
envVars.put("WEBSITE_SITE_NAME", "---");
envVars.put("WEBSITES_ENABLE_APP_SERVICE_STORAGE", "false");
envVars.put("WEBSITE_INSTANCE_ID", "1234");
envVars.put("WEBSITE_RESOURCE_GROUP", "test");
envVars.put("WEBSITE_SKU", "1234");
Environment environment = getEnvironmentWithEnvVariables(envVars);
CloudPlatform platform = CloudPlatform.getActive(environment);
assertThat(platform).isEqualTo(CloudPlatform.AZURE_APP_SERVICE);
Expand Down