azure-dev icon indicating copy to clipboard operation
azure-dev copied to clipboard

[Issue] siteConfig settings (linuxFxVersion/appCommandLine) aren't updated incrementally

Open pamelafox opened this issue 2 years ago • 1 comments

  • [x] Make sure you've installed the latest version using instructions in the wiki

Output from azd version

azd version 0.3.0-beta.2 (commit 91a2c014887ebda63a0af2e623278f8ac40ce376)

Output from az version

{
  "azure-cli": "2.40.0",
  "azure-cli-core": "2.40.0",
  "azure-cli-telemetry": "1.0.8",
  "extensions": {
    "containerapp": "0.3.11",
    "containerapp-compose": "0.2.2"
  }
}

Describe the bug

When I do repeated azd deploy commands with changes to properties.siteConfig in my Microsoft.Web/sites resource, I don't see the changes made in the portal. I have to instead make the changes manually in the portal.

To Reproduce

  1. Clone this repo: https://github.com/pamelafox/msdocs-django-postgresql-sample-app-azd
  2. Run azd up
  3. Change the appCommandLine to something else, run azd up again
    appCommandLine: 'python manage.py runserver'
    
  4. See that the value hasn't changed in the Portal.

Expected behavior

I expected the configuration properties to change under "General settings" in the portal, but it remained unchanged.

pamelafox avatar Oct 19 '22 22:10 pamelafox

We have been seeing app service issues over the last couple of days. This could be related.

jongio avatar Oct 20 '22 00:10 jongio

Just experienced this again when attempting to change configuration settings on a function app.

Bicep change: https://github.com/pamelafox/regression-model-azure-demo/commit/691fc74a62a2f1b903abd11c03737d3aa1a1ef4e

I had to make the configuration changes manually in the Azure Portal.

pamelafox avatar Oct 31 '22 11:10 pamelafox

Can you please see if you can get a repro of this without azd, just using az deployment? We are also seeing this and trying to see determine if this is an az or azd issue or rp issue.

jongio avatar Oct 31 '22 13:10 jongio

I just tried az deployment to change the linuxVersion and it seems to have succeeded.

Bicep diff:

--- a/infra/resources.bicep
+++ b/infra/resources.bicep
@@ -71,7 +71,7 @@ resource functionApp 'Microsoft.Web/sites@2020-06-01' = {
     serverFarmId: hostingPlan.id
     clientAffinityEnabled: false
     siteConfig: {
-      linuxFxVersion: 'Python|3.9'
+      linuxFxVersion: 'Python|3.8'
       appSettings: [
         {
            name: 'APPINSIGHTS_INSTRUMENTATIONKEY'

Logs:

% az deployment group create \
    --resource-group salary-model-rg \
    --template-file infra/resources.bicep \
    -c
Please provide string value for 'name' (? for help): salary-model
Please provide string value for 'resourceToken' (? for help): v5dvp62jp2mjg
Please provide object value for 'tags' (? for help): { 'azd-env-name': 'salary-model'}
Note: The result may contain false positive predictions (noise).
You can help us improve the accuracy of the result by opening an issue here: https://aka.ms/WhatIfIssues

Resource and property changes are indicated with these symbols:
  + Create
  ~ Modify
  = Nochange
  * Ignore
  x Noeffect

The deployment will update the following scope:

Scope: /subscriptions/32ea8a26-5b40-4838-b6cb-be5c89a57c16/resourceGroups/salary-model-rg

  ~ Microsoft.Insights/components/salary-model-v5dvp62jp2mjg-appinsights [2020-02-02-preview]
    + properties.Flow_Type:      "Bluefield"
    + properties.Request_Source: "rest"

  ~ Microsoft.Web/sites/salary-model-v5dvp62jp2mjg-function-app [2020-06-01]
    + properties.siteConfig.localMySqlEnabled:   false
    + properties.siteConfig.netFrameworkVersion: "v4.6"
    ~ properties.siteConfig.linuxFxVersion:      "Python|3.9" => "Python|3.8"

  = Microsoft.OperationalInsights/workspaces/salary-model-v5dvp62jp2mjg-logworkspace [2021-12-01-preview]
    x properties.features:

        searchVersion: 1


  = Microsoft.Storage/storageAccounts/salarymodelv5dvp6storage [2019-06-01]
  = Microsoft.Web/serverfarms/salary-model-v5dvp62jp2mjg-plan [2020-10-01]
  * microsoft.alertsmanagement/smartDetectorAlertRules/Failure Anomalies - salary-model-v5dvp62jp2mjg-appinsights

Resource changes: 2 to modify, 3 no change, 1 to ignore.
Are you sure you want to execute the deployment? (y/n): y

And then when I check in the Portal and clicked JSON view for the function app, I see this in the JSON:

            "metadata": null,
            "properties": [
                {
                    "name": "LinuxFxVersion",
                    "value": "Python|3.8"
                },
                {
                    "name": "WindowsFxVersion",
                    "value": null
                }
            ],
            "appSettings": null
        },
       ...

I'll try a configuration setting change next too.

pamelafox avatar Oct 31 '22 21:10 pamelafox

I've now tried a change to the configuration app settings. That change also went through with az deployment, though what-if didn't catch it:

Bicep diff:

diff --git a/infra/resources.bicep b/infra/resources.bicep
index 6be5b89..36d3d48 100644
--- a/infra/resources.bicep
+++ b/infra/resources.bicep
@@ -93,14 +93,6 @@ resource functionApp 'Microsoft.Web/sites@2020-06-01' = {
           name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING'
           value: 'DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};EndpointSuffix=${az.environment().suffixes.storage};AccountKey=${listKeys(storageAccount.id, storageAccount.apiVersion).keys[0].value}'
         }
-        {
-          name: 'ENABLE_ORYX_BUILD'
-          value: 'true'
-        }
-        {
-          name: 'SCM_DO_BUILD_DURING_DEPLOYMENT'
-          value: 'true'
-        }
       ]
     }
   }

az output:

The deployment will update the following scope:

Scope: /subscriptions/32ea8a26-5b40-4838-b6cb-be5c89a57c16/resourceGroups/salary-model-rg

  ~ Microsoft.Insights/components/salary-model-v5dvp62jp2mjg-appinsights [2020-02-02-preview]
    + properties.Flow_Type:      "Bluefield"
    + properties.Request_Source: "rest"

  ~ Microsoft.Web/sites/salary-model-v5dvp62jp2mjg-function-app [2020-06-01]
    + properties.siteConfig.localMySqlEnabled:   false
    + properties.siteConfig.netFrameworkVersion: "v4.6"

  = Microsoft.OperationalInsights/workspaces/salary-model-v5dvp62jp2mjg-logworkspace [2021-12-01-preview]
    x properties.features:

        searchVersion: 1


  = Microsoft.Storage/storageAccounts/salarymodelv5dvp6storage [2019-06-01]
  = Microsoft.Web/serverfarms/salary-model-v5dvp62jp2mjg-plan [2020-10-01]
  * microsoft.alertsmanagement/smartDetectorAlertRules/Failure Anomalies - salary-model-v5dvp62jp2mjg-appinsights

Resource changes: 2 to modify, 3 no change, 1 to ignore.

Are you sure you want to execute the deployment? (y/n): y

The settings no longer are displayed in the portal in Configuration > Application settings.

pamelafox avatar Oct 31 '22 22:10 pamelafox

I just tried reverting that diff, and az deployment once again successfully brought back the app settings, despite what-if not detecting the change.

az deployment group create \
    --resource-group salary-model-rg \
    --template-file infra/resources.bicep \
    -c
Please provide string value for 'name' (? for help): salary-model
Please provide string value for 'resourceToken' (? for help): v5dvp62jp2mjg
Please provide object value for 'tags' (? for help): { 'azd-env-name': 'salary-model'}
Note: The result may contain false positive predictions (noise).
You can help us improve the accuracy of the result by opening an issue here: https://aka.ms/WhatIfIssues

Resource and property changes are indicated with these symbols:
  + Create
  ~ Modify
  = Nochange
  * Ignore
  x Noeffect

The deployment will update the following scope:

Scope: /subscriptions/32ea8a26-5b40-4838-b6cb-be5c89a57c16/resourceGroups/salary-model-rg

  ~ Microsoft.Insights/components/salary-model-v5dvp62jp2mjg-appinsights [2020-02-02-preview]
    + properties.Flow_Type:      "Bluefield"
    + properties.Request_Source: "rest"

  ~ Microsoft.Web/sites/salary-model-v5dvp62jp2mjg-function-app [2020-06-01]
    + properties.siteConfig.localMySqlEnabled:   false
    + properties.siteConfig.netFrameworkVersion: "v4.6"

  = Microsoft.OperationalInsights/workspaces/salary-model-v5dvp62jp2mjg-logworkspace [2021-12-01-preview]
    x properties.features:

        searchVersion: 1


  = Microsoft.Storage/storageAccounts/salarymodelv5dvp6storage [2019-06-01]
  = Microsoft.Web/serverfarms/salary-model-v5dvp62jp2mjg-plan [2020-10-01]
  * microsoft.alertsmanagement/smartDetectorAlertRules/Failure Anomalies - salary-model-v5dvp62jp2mjg-appinsights

Resource changes: 2 to modify, 3 no change, 1 to ignore.

Are you sure you want to execute the deployment? (y/n): y

The settings are now back to being displayed in the portal in Configuration > Application settings.

pamelafox avatar Oct 31 '22 22:10 pamelafox

@jongio remember you had made fixes to our Bicep modules for the app service issues. We haven't seen this lately. Can we close this pointing to the Bicep PR fix?

rajeshkamal5050 avatar Dec 14 '22 20:12 rajeshkamal5050

@pamelafox - Are you able to repro this with latest azd?

jongio avatar Dec 14 '22 20:12 jongio

I just attempted reproducing with latest azd by changing linuxFxVersion and then appCommandLine and both changes went through! I believe this can be closed.

pamelafox avatar Dec 17 '22 00:12 pamelafox

Okay, Thank you.

jongio avatar Jan 03 '23 18:01 jongio