question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding app settings to existing Function App creates a new storage account

See original GitHub issue

Creating a new storage account is an unintended consequence of calling

functionApp.Update()
.WithAppSetting("key", "value")
.Apply();

This also causes the currently deployed functions to be lost since the function app is now pointing at a new storage account.

The offending code is in FunctionAppImpl.cs Line 163-166

I think the root cause of this issue is that the currentStorageAccount is never populated with the actual storage account that is associated with the function app

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
m-mertzcommented, Sep 6, 2018

There’s a simple workaround for app settings, and possibly other properties that are inherited from web apps. This works because a Function App is just a special Web App, so we can use those methods instead:

IWebApp app = await azure.WebApps.GetByResourceGroupAsync(resourceGroup, functionAppName).ConfigureAwait(false);
await app.Update().WithAppSetting("testsetting", "value").ApplyAsync().ConfigureAwait(false);

Interestingly enough, the WebApp.List* methods don’t show function apps, but they can be retrieved through the Get* methods.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Storage considerations for Azure Functions
Storage accounts created as part of the function app create flow in the Azure portal are guaranteed to work with the new function...
Read more >
Azure Function App create cannot select existing storage ...
Yes, at present, by design, during creation of the Function app via Azure Portal, you cannot change the storage account, though the portal...
Read more >
AzureWebJobsStorage, the secret you don't need in your ...
By default when you create a Function App with its storage account from Azure Portal, the setting AzureWebJobsStorage is automatically ...
Read more >
Creating your first Azure Function App
Navigate to the Azure Portal in your cloud account and click the Function App service. Click Create Function App. You can now create...
Read more >
Azure Functions with Managed Identity Storage Access
Step 1: Enable Managed Identity for Azure Function App · Step 2: Grant Access to Azure Storage · Step 3: Configure the Function...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found