https://pulumi.com logo
Title
r

red-finland-22910

01/24/2023, 8:01 AM
Hi @echoing-match-29901, I'm currently creating an Azure storage account using the following code.
private void InitStorageAccount(Config config)
        {
            var storageAccount = new StorageAccount("saaggregatorservice", new StorageAccountArgs
            {
                ResourceGroupName = ResourceGroup.Name,
                AccountName = $"saaggregatorservice{config.Env}",
                Sku = new StorageSkuArgs
                {
                    Name = SkuName.Standard_LRS
                },
                Kind = Kind.StorageV2,
                Tags = config.DefaultTags,
            });

            var saKey = Output.Tuple(storageAccount.Name, ResourceGroup.Name, Output.CreateSecret(""), storageAccount.Id).Apply(
                t => ListStorageAccountKeys.InvokeAsync(new ListStorageAccountKeysArgs
                {
                    AccountName = t.Item1,
                    ResourceGroupName = t.Item2,
                })).Apply(result => result.Keys.First().Value);
            StorageConnectionString =
                Output.Format($"DefaultEndpointsProtocol=https;AccountName={storageAccount.Name};AccountKey={saKey}");
        }
Before the update to 3.51.* this code was successfully able to generate a service account. Now however, I'm faced with the following error: Error:
azure-native:web:WebApp (aggregatorFunctionApp):
    error: Code="BadRequest" Message="There was a conflict. The remote name could not be resolved: '<http://saaggregatorservice.file.core.windows.net|saaggregatorservice.file.core.windows.net>'" Details=[{"Message":"There was a conflict. The remote name could not be resolved: '<http://saaggregatorservice.file.core.windows.net|saaggregatorservice.file.core.windows.net>'"},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","ExtendedCode":"01020","Message":"There was a conflict. The remote name could not be resolved: '<http://saaggregatorservice.file.core.windows.net|saaggregatorservice.file.core.windows.net>'","MessageTemplate":"There was a conflict. {0}","Parameters":["The remote name could not be resolved: '<http://saaggregatorservice.file.core.windows.net|saaggregatorservice.file.core.windows.net>'"]}}]
Is anyone able to assist in debugging?
e

echoing-dinner-19531

01/24/2023, 9:36 AM
Worth raising an issue at https://github.com/pulumi/pulumi-azure-native/issues for that if pre 3.51 reliably works and 3.51 doesn't.
r

red-finland-22910

01/25/2023, 2:29 AM
Thanks Fraser - I managed to work through this issue although now presented with the image atttached. It appears the function app keys are not automatically generated in Azure DevOps. My code to instantiate a function app is as follows:
public class FunctionApp
    {
        public Output<string> FunctionAppName { get; }
        public Output<string> FunctionAppKey { get; }
        public Output<string> FunctionEndpoint { get; }

        public FunctionApp(Config config, SharedResources shared)
        {
            var functionAppName = $"fn-aggregator-{config.Env}";
            var functionApp = new WebApp("aggregatorFunctionApp", new WebAppArgs
            {
                ResourceGroupName = shared.ResourceGroup.Name,
                Name = functionAppName,
                ServerFarmId = shared.AppServicePlan.Id,
                Kind = "functionapp",
                Identity = new ManagedServiceIdentityArgs { Type = ManagedServiceIdentityType.SystemAssigned },
                SiteConfig = new SiteConfigArgs
                {
                    AppSettings =
                    {
                        new NameValuePairArgs {Name = "AzureWebJobsStorage", Value = shared.StorageConnectionString},
                        //new NameValuePairArgs
                        //    {Name = "AzureWebJobsServiceBus", Value = queues.ServiceBusConnectionString},
                        new NameValuePairArgs
                              {Name = "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING", Value = shared.StorageConnectionString},
                        new NameValuePairArgs {Name = "WEBSITE_CONTENTSHARE", Value = functionAppName},
                        new NameValuePairArgs {Name = "FUNCTIONS_EXTENSION_VERSION", Value = "~4"},
                        new NameValuePairArgs {Name = "FUNCTIONS_WORKER_RUNTIME", Value = "dotnet"},
                        new NameValuePairArgs {Name = "WEBSITE_RUN_FROM_PACKAGE", Value = "1"},
                        //new NameValuePairArgs
                        //    {Name = "APPINSIGHTS_INSTRUMENTATIONKEY", Value = shared.Insights.InstrumentationKey},
                        new NameValuePairArgs {Name = "LendSandboxApiKey", Value = config.LendSandboxApiKey},
                        new NameValuePairArgs {Name = "GetFullLead", Value = config.GetFullLead},
                        new NameValuePairArgs {Name = "CORECLR_ENABLE_PROFILING", Value = "1"},
                        new NameValuePairArgs {Name = "CORECLR_PORFILER", Value = config.CORECLR_PORFILER},
                        new NameValuePairArgs {Name = "CORECLR_PROFILER_PATH", Value = config.CORECLR_PROFILER_PATH},
                        new NameValuePairArgs {Name = "DD_ENV", Value = config.DatadogEnvironment},
                        new NameValuePairArgs {Name = "DD_SERVICE", Value = config.DatadogIntegrationServiceName},
                        new NameValuePairArgs {Name = "DD_VERSION", Value = config.DatadogIntegrationServiceVersion},
                        new NameValuePairArgs {Name = "DD_DOTNET_TRACER_HOME", Value = config.DD_DOTNET_TRACER_HOME},
                        new NameValuePairArgs {Name = "DD_API_KEY", Value = config.DatadogApiKey},
                        new NameValuePairArgs {Name = "DD_SITE", Value = config.DD_SITE},
                        new NameValuePairArgs {Name = "DD_LOGS_INJECTION", Value = "true"},
                        //new NameValuePairArgs {Name = "DD_LOGS_DIRECT_SUBMISSION_INTEGRATIONS", Value = "ILogger"},
                        new NameValuePairArgs {Name = "logging:logLevel:Microsoft.Azure.WebJobs.Script.WebHost.Middleware.SystemTraceMiddleware", Value = "None"},
                    },
                    AlwaysOn = true
                },
                Tags = config.DefaultTags,
            });

            FunctionAppName = functionApp.Name;
            
            FunctionAppKey = Output.Tuple(functionApp.Name, shared.ResourceGroup.Name, Output.CreateSecret(""), functionApp.Id).Apply(
                t => ListWebAppHostKeys.InvokeAsync(new ListWebAppHostKeysArgs
                {
                    Name = t.Item1,
                    ResourceGroupName = t.Item2,
                })).Apply(result => result.MasterKey);

            FunctionEndpoint = Output.Format($"https://{functionApp.DefaultHostName}/api");
        }
    }