Home > database >  How can I use the Options pattern (IOptions) with Azure Functions Premium? (it does not allow colons
How can I use the Options pattern (IOptions) with Azure Functions Premium? (it does not allow colons

Time:01-14

Summary: I would like to use the Options Pattern with Azure Functions Premium, but to do so I need to put app settings in the format:

"Values": {
    "MyOptions:MyCustomSetting": "Foobar"
}

But it seems that Azure Functions premium does not allow colons ":" in app setting names.

Is the Options pattern possible in Azure Functions premium?

More detail:

I recently migrated an app from a consumption plan to a premium plan. To do this I deleted and recreated the function app, but the deployment failed with an error:

AppSetting with name 'OidcApiAuthSettings:Audience' is not allowed

In the consumption plan version of my app, I have a bunch of settings using this format in order to follow the Options pattern for strongly typed configuration.

I checked through the portal, and sure enough, in a consumption plan I can create settings in this format, but in a premium plan I get a message: "App setting names can only contain letters, numbers (0-9), periods ("."), and underscores ("_")"

CodePudding user response:

Use double underscore to replace colons:

'OidcApiAuthSettings__Audience'
  •  Tags:  
  • Related