-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WindowsFunctionApp with existing AppServicePlans #1922
Comments
Could you expand on how you're getting the value for the resource ID from Pulumi - please share some example Pulumi code if at all possible. It looks like the error you've shared is possibly from within your function app rather that from you Pulumi code. Some resource id segments are case insensitive, and Azure sometimes returns different casing too. It's possible that the library producing this error is being overly strict, though this should also be fairly easy to work around with a string replacement if in doubt. |
Hi @danielrbradley , Thanks for reply. I am creating WindowsFunctionApp (Pulumi Classic) as below private WindowsFunctionApp CreateFunctionResource(string appName, Plan appServicePlan, FunctionSettings functionSettings, InputMap<string> settings = null, int maxScaleOutLimit = 0)
{
var configurations = new InputMap<string>
{
................
................
};
if (settings != null)
{
configurations.AddRange(settings);
}
var funcAppArgs = new WindowsFunctionAppArgs
{
ResourceGroupName = _coreSettings.ResourceGroup,
ServicePlanId = appServicePlan.Id,
Name = appName,
FunctionsExtensionVersion = _coreSettings.Functions.ExtensionVersion, // v4
Identity = new WindowsFunctionAppIdentityArgs
{
Type = "SystemAssigned"
},
StorageAccountName = _storageAccountName,
StorageAccountAccessKey = _storageAccountKey,
AppSettings = configurations,
SiteConfig = new WindowsFunctionAppSiteConfigArgs
{
AlwaysOn = functionSettings.IsDedicatedPlan(),
AppScaleLimit = maxScaleOutLimit,
ApplicationStack = new WindowsFunctionAppSiteConfigApplicationStackArgs
{
DotnetVersion = _coreSettings.Functions.DotnetFrameworkVersion, // v8.0
UseDotnetIsolatedRuntime = true
}
}
};
var functionApp = new WindowsFunctionApp($"{appName}", funcAppArgs);
return functionApp;
}
private Plan CreateAppServicePlan(FunctionSettings functionSettings, string planName)
{
var appServicePlan = new Plan(planName, new PlanArgs
{
Location = _coreSettings.Region,
ResourceGroupName = _coreSettings.ResourceGroup,
Kind = "FunctionApp",
Name = planName,
Sku = new PlanSkuArgs
{
Tier = functionSettings.SkuTier,
Size = functionSettings.SkuName // Consumption Plan
}
});
return appServicePlan;
} If a function app with same name created with FunctionApp (classic) already exists WindowsFunctionApp gives following error |
Hi @ranjeetkpGit! This issue may have been fixed in the latest provider version, see this upstream issue. Could you try upgrading Azure Classic to v5.72.0? |
Hi @thomas11 Thanks for reply. As FunctionApp (classic) supports till .NET 6 only, Is there any way we can upgrade it to WindowsFunctionApp without deleting existing resources? |
Hi @ranjeetkpGit, the issue title and your code sample show that you're already using WindowsFunctionApp. Is that not correct? |
@thomas11, This code is to upgrade existing FunctionApp (created with FunctionApp (.NET 6)) to .NET 8 using WindowsFunctionApp. Instead of updating existing FunctionApp it shows error given in screenshot |
I see. Could you try upgrading Azure Classic to v5.72.0? Or is there an issue preventing that? |
I'm not familiar with this specific case, but after changing your code from FunctionApp to WindowsFunctionApp, you probably need to run If that's not sufficient, you'll need to import the app via its Azure id that you can find in the Azure portal. |
@thomas11 I've been looking at this as well. I'm using the latest Azure Classic and when you try to import the
Which feels like it's linked to this issue: #1879 which as guin pointed out is linked to this issue: hashicorp/terraform-provider-azurerm#19600 which has been closed as stale. |
@pierskarsenbarg do you happen to have a full repro? I think I know how to fix it but cannot verify the fix without a bunch of manual setup. |
I've got the code for it... let me put a repo together that you can just clone and work with |
I can't replicate this anymore. I'm not sure why. Trying v5.73.0 (which was probably the version I was on when I tried it) as well as v5.68.0 which is what the customer seemed to be on. Let me go back to the customer and see if this is still an issue |
Hi,
We have existing AppServicePlans created with AppServicePlan(Native) and Plan (Classic) components but when referencing them in WindowsFunctionApp, getting following error. WindowsFunctionApp expects 'serverFarms' (We get serverFarms when creating new plans using ServicePlan component)
but we get 'serverfarms' from existing AppServicePlans
Is there any way we can create WindowsFunctionApp with existing AppServicePlan ?
We are using C# and .NET 8 to create Azure resources.
The text was updated successfully, but these errors were encountered: