Hey guys. I'm using Pulumi to create a Storage Acc...
# general
a
Hey guys. I'm using Pulumi to create a Storage Account, App Service Plan and Function App. However, even thouhg the CLI says that all resources have been created, the Storage Account is nowhere to be found. Additionally, after finding that by default Pulumi creates Function Apps with the very out of date
FUNCTIONS_EXTENSION_VERSION
version
~1
, I explicitly added an app setting to set it to
~2
, but this is being ignored. Happy to share code and screenshots somewhere a little more private. Thanks.
p
not sure what language you are using, but FunctionApp has a property called
version
. Try setting that to
~2
b
have you checked that you're not accidentally creating the storageaccount in an unrelated subscription by not specifying the provider? there's a concept of ambient providers which often causes a lot of confusion
if you export the stack and view the resource definitions (or look at the stack file if you're saving it locally) it should give you a clue about where it ended up
a
@plain-eye-9759 - I'm using JS. I've found the docs that show the version property, but sadly adding this did not work.
p
Can you share a snippet of your code? That'll help to know what could be wrong
a
@better-rainbow-14549 - With regards to Subscription, during the quick start the following is statement is shown. Therefore I would expect Pulumi to use the Subscription set using
az account set
-
If you have previously configured the Azure CLI, 
az
, Pulumi will respect and use your configuration settings
Certainly when I look at resources for the relevant stack in the console, the given resource ID for the Storage Account shows the expected Subscription ID and Resource Group. However, clicking the "Open in Azure Portal" link next to the resource results in an infinite spinner, suggesting the Storage Account does not exist. I suspect that Storage Account creation is failing for some reason, but that Pulumi is not catching it and recording the activity as successful.
@plain-eye-9759 - this is the exact code I am using, with the exception of the
name
property of each resource.
Copy code
"use strict";
const pulumi = require("@pulumi/pulumi");
const azure = require("@pulumi/azure");

// Create a Resource Group.
const resourceGroup = new azure.core.ResourceGroup("resourceGroup", {
    name: "example-resource-group",
    tags: {
        application: "Example Application",
        environment: "DEV",
        version: "0.0.1"
    }
});

// Create a Storage Account for the Function App to use.
const storageAccount = new azure.storage.Account("storageAccount", {
    name: "examplestorage",
    resourceGroupName: resourceGroup.name,
    accountTier: "Standard",
    accountReplicationType: "LRS",
});

// Create an App Service Plan for the Funciton App to run on.
const appServicePlan = new azure.appservice.Plan("appServicePlan", {
    name: "example-app-service-plan",
    kind: "FunctionApp",
    resourceGroupName: resourceGroup.name,
    sku: {
        size: "Y1",
        tier: "Dynamic"
    }
});

// Create a Function App.
const functionApp = new azure.appservice.FunctionApp("functionApp", {
    name: "example-function-app",
    appServicePlanId: appServicePlan.id,
    resourceGroupName: resourceGroup.name,
    storageConnectionString: storageAccount.primaryConnectionString,
    version: "~2",
    appSettings: {
        FUNCTIONS_WORKER_RUNTIME: "powershell"
    }
});

// Export the primary connection string for the Storage Account
exports.storageAccountConnectionString = storageAccount.primaryConnectionString;
exports.FunctionAppHostKeys = storageAccount.primaryConnectionString;
p
The configuration that works for me is to specify
version
like you have done, then also in the appSettings, to set
FUNCTIONS_EXTENSION_VERSION: "~2"
a
@plain-eye-9759 - Setting both does work, thanks. I assumed it would be just one - but I suppose life is never that simple!
👍 1
p
Cool. I find it odd to have to set it twice
So did you resolve the storage account issue yet @ambitious-crayon-56788?
a
@plain-eye-9759 - not yet. Currently having issues getting Pulumi to work at all. Apparently the SDK has not been installed, even though I was using it yesterday/today! I think I'm just going to delete it all and start again, see if that helps any.