Hi, A question on the Azure Web Apps and having al...
# general
r
Hi, A question on the Azure Web Apps and having all the existing App Settings wiped!! It appears that any non-Pulumi app settings are getting wiped even when Pulumi indicates that it will not be updating the App Settings. This was a Pulumi Preview --diff for a function app of mine. No AppSetting changes indicated. I did the Pulumi Up and all existing App Settings were deleted. Very annoying!! This was after doing a Refresh and then also an Import to ensure all existing settings were discovered. However it does not appear that AppSettings are gathered into state using either. Is this expected behaviour or am I missing something? Ran
pulumi preview --target 'urn:pulumi:qa::gqt::azure-native:web:WebApp::######-func-gqtproperty-qa-ne' --diff
Got following response
Copy code
Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.75

'dotnet build -nologo .' completed successfully
  pulumi:pulumi:Stack: (same)
    [urn=urn:pulumi:qa::gqt::pulumi:pulumi:Stack::gqt-qa]
    --outputs:--
  + Readme: output<string>
    ~ azure-native:web:WebApp: (update)
        [id=/subscriptions/#####/resourceGroups/#####-rg-gqt-qa-ne/providers/Microsoft.Web/sites/#####-func-gqtproperty-qa-ne]
        [urn=urn:pulumi:qa::gqt::azure-native:web:WebApp::#####-func-gqtproperty-qa-ne]
        [provider: urn:pulumi:qa::gqt::pulumi:providers:azure-native::default_1_64_1::2ed5c319-5430-469d-9031-83ac95dd6fc9 => urn:pulumi:qa::gqt::pulumi:providers:azure-native::default_1_66_0::f2b4d03f-0b4d-4628-8f22-da8abd55a375]
      ~ tags                  : {
          ~ Purpose: "Contain Bedroom Genie Resources" => "Contains Groups Quoting Tool (GQT) Resources"
        }
      ~ virtualNetworkSubnetId: "/subscriptions/#####/resourceGroups/#####-rg-network-qa-Ne/providers/Microsoft.Network/virtualNetworks/#####-vnet-intrt-qa-Ne/subnets/#####-snet-intrt-qa-Ne-002" => "/subscriptions/#####/resourcegroups/#####-rg-network-qa-ne/providers/microsoft.network/virtualnetworks/#####-vnet-intrt-qa-ne/subnets/#####-snet-intrt-qa-ne-002"
Resources:
    ~ 1 to update
    124 unchanged
My WebApp code looks like
Copy code
var webAppArgs = new WebAppArgs
{
	Name = funcAppName,
	Kind = "functionapp,linux",
	ResourceGroupName = args.ResourceGroupName,
	ServerFarmId = args.ServerFarmId,
	HttpsOnly = true,
	SiteConfig = new SiteConfigArgs
	{
		Cors = new CorsSettingsArgs() { AllowedOrigins = "*" },
		AlwaysOn = true,
		AppSettings = new[]
		{
			new NameValuePairArgs
			{
				Name = "AzureWebJobsStorage",
				Value = AsfPulumiHelper.GetConnectionString(args.ResourceGroupName,
					args.FuncStorageAccountName),
			},
			new NameValuePairArgs
			{
				Name = "FUNCTIONS_WORKER_RUNTIME",
				Value = "dotnet",
			},
			new NameValuePairArgs
			{
				Name = "FUNCTIONS_EXTENSION_VERSION",
				Value = "~4"
			},
			new NameValuePairArgs
			{
				Name = "APPLICATIONINSIGHTS_CONNECTION_STRING",
				Value = Output.Format($"InstrumentationKey={args.AppInsightsInstrumentKey}"),
			},
			new NameValuePairArgs
			{
				Name = "APPINSIGHTS_INSTRUMENTATIONKEY",
				Value = args.AppInsightsInstrumentKey
			},
		}
	},
	Identity = new Pulumi.AzureNative.Web.Inputs.ManagedServiceIdentityArgs
	{
		Type = ManagedServiceIdentityType.SystemAssigned,
	},
	Tags = args.Tags
};
if (!string.IsNullOrEmpty(args.VnetSubNetId))
{
	webAppArgs.VirtualNetworkSubnetId = args.VnetSubNetId;
}