Azure-Functions icon indicating copy to clipboard operation
Azure-Functions copied to clipboard

Environment variable WEBSITE_OWNER_NAME changed in Azure Functions on Consumption Flex plan

Open Bataran opened this issue 1 year ago • 8 comments

Is your question related to a specific version? If so, please specify:

Tested on Node.js 20x on Consumpltion Flex plan

What language does your question apply to? (e.g. C#, JavaScript, Java, All)

Node.js, but most likely other languages too

Question

It seems that WEBSITE_OWNER_NAME environment variable format changed on the new Consumption Flex plan. The new format is something like this: <subscription-id>+flex-99ddf98v18fee2c3d86cb4d0f37573099297d5124520437bfa4ee00d9fc8ff8e-webspace comparing to the format on the old Consumption plan: <subscription-id>+<resource-group>-<region>webspace-Linux

Since the variable is not publicly documented it's expected to change, but still it was the only way to get resource group from within the function (without fetching it from other sources).

The question is: should we expect to have the new format also in the old Consumption plan (not Flex)? If yes, will users have some other way to obtain resource group within the function as also the WEBSITE_RESOURCE_GROUP is missing in both Consumption and Consumption Flex plans?

Bataran avatar Aug 30 '24 09:08 Bataran

Hello @Bataran thank you for reporting will check and let you know further steps.

JAdluri avatar Dec 19 '24 09:12 JAdluri

Hello could you pl. check now on the same issue if its still existing as i didnt encouter this kind of issue when i tried to reproduce the same thing on my end.

JAdluri avatar Dec 20 '24 09:12 JAdluri

/bot not-stale

Bataran avatar Dec 26 '24 16:12 Bataran

Thank you Bataran. This issue will not be automatically closed and a member of the team will review it soon.

I'll check when I'm back from vacation.

Bataran avatar Dec 26 '24 16:12 Bataran

Hi, I tried this again with a newly created function in the "North Europe" region. The WEBSITE_OWNER_NAME variable structure is still different from the variable in the old Consumption plan. You can simply console.log(process.env.WEBSITE_OWNER_NAME) and compare it in the functions with the two different Consumption plans.

Bataran avatar Jan 14 '25 11:01 Bataran

On checking further, WEBSITE_OWNER_NAME is a publicly documented environment variable - Link. Which seems that in Flex consumption, we are changing this appsetting behavior. This can also break customers who are migrating from old consumption to Flex consumption plan.

cc @nzthiago

surgupta-msft avatar Apr 02 '25 20:04 surgupta-msft

@mathewc or @balag0 do you have any notes on this one? It would be good to have WEBSITE_OWNER_NAME and WEBSITE_RESOURCE_GROUP populated for Flex Consumption as documented here.

nzthiago avatar Apr 02 '25 23:04 nzthiago