diff --git a/internal/services/appservice/helpers/function_app_schema_test.go b/internal/services/appservice/helpers/function_app_schema_test.go index bc5453c9bc40..74650baaf155 100644 --- a/internal/services/appservice/helpers/function_app_schema_test.go +++ b/internal/services/appservice/helpers/function_app_schema_test.go @@ -2,6 +2,7 @@ package helpers_test import ( "reflect" + "sort" "testing" "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" @@ -56,6 +57,10 @@ func TestMergeUserAppSettings(t *testing.T) { "test4": "UserValue4", }, expected: []web.NameValuePair{ + { + Name: utils.String("test"), + Value: utils.String("UserValue"), + }, { Name: utils.String("test2"), Value: utils.String("ServiceValue2"), @@ -64,10 +69,6 @@ func TestMergeUserAppSettings(t *testing.T) { Name: utils.String("test3"), Value: utils.String("ServiceValue3"), }, - { - Name: utils.String("test"), - Value: utils.String("UserValue"), - }, { Name: utils.String("test4"), Value: utils.String("UserValue4"), @@ -77,9 +78,13 @@ func TestMergeUserAppSettings(t *testing.T) { } for _, v := range cases { - actual := helpers.MergeUserAppSettings(&v.service, v.user) - if !reflect.DeepEqual(*actual, v.expected) { - t.Fatalf("expected %+v, got %+v", v.expected, *actual) + actualRaw := helpers.MergeUserAppSettings(&v.service, v.user) + actual := *actualRaw + sort.Slice(actual, func(i, j int) bool { + return *actual[i].Name < *actual[j].Name + }) + if !reflect.DeepEqual(actual, v.expected) { + t.Fatalf("expected %+v, got %+v", v.expected, actual) } } } diff --git a/internal/services/appservice/linux_function_app_resource.go b/internal/services/appservice/linux_function_app_resource.go index 895cd64470af..7c2afbcd6177 100644 --- a/internal/services/appservice/linux_function_app_resource.go +++ b/internal/services/appservice/linux_function_app_resource.go @@ -1022,6 +1022,12 @@ func (m *LinuxFunctionAppModel) unpackLinuxFunctionAppSettings(input web.StringD case "AzureWebJobsDashboard__accountName": m.BuiltinLogging = true + case "WEBSITE_RUN_FROM_PACKAGE": + // Keep if user explicitly set, otherwise filter out as will have been added by ADO et al + if _, ok := metadata.ResourceData.GetOk("app_settings.WEBSITE_RUN_FROM_PACKAGE"); ok { + appSettings[k] = utils.NormalizeNilableString(v) + } + default: appSettings[k] = utils.NormalizeNilableString(v) } diff --git a/internal/services/appservice/linux_function_app_slot_resource.go b/internal/services/appservice/linux_function_app_slot_resource.go index 3dd686a2de4a..c9dc5c0ff34e 100644 --- a/internal/services/appservice/linux_function_app_slot_resource.go +++ b/internal/services/appservice/linux_function_app_slot_resource.go @@ -868,6 +868,11 @@ func (m *LinuxFunctionAppSlotModel) unpackLinuxFunctionAppSettings(input web.Str case "AzureWebJobsDashboard__accountName": m.BuiltinLogging = true + case "WEBSITE_RUN_FROM_PACKAGE": + if _, ok := metadata.ResourceData.GetOk("app_settings.WEBSITE_RUN_FROM_PACKAGE"); ok { + appSettings[k] = utils.NormalizeNilableString(v) + } + default: appSettings[k] = utils.NormalizeNilableString(v) }