Hi everyone, hope you are all doing well. I'm tryi...
# azure
j
Hi everyone, hope you are all doing well. I'm trying to upload databases when the infrastructure is setup. I'm doing the following which was taken from one of the examples. But I'm getting this error: error: Future#WaitForCompletion: the number of retries has been exceeded: StatusCode=400 -- Original Error: Code="BadRequest" Message="The ImportExport operation with Request Id 'cab7833d-f042-4dc9-b98f-b007989b0e48' failed due to 'Cannot create a BACPAC from a file that does not contain exported data.'." Details=[] InnerError={"multi":[]} From what I'm seeing online this can be because the bacpac contains the schema and no data. That might be right, as this is the blank version of the database when the application starts. Is there a way of altering this code snippet or another way to achieve this using Pulumi? I'm trying to do 18 databases some will have data and others will be blank schema initial versions. Any help greatly appreciated.
Copy code
var exampleBlob = new Azure.Storage.Blob("blob-" + name, new Azure.Storage.BlobArgs
            {
                StorageAccountName = storageAccount.Name,
                StorageContainerName = container.Name,
                Type = "Block",
                Source = new FileAsset(file),
            }, new CustomResourceOptions() { Parent = this, DependsOn = new InputList<Resource>() { container, storageAccount } });
        
            var exampleDatabase = new Azure.Sql.Database( name, new Azure.Sql.DatabaseArgs
            {
                MaxSizeGb = size.MaxSize,
                Edition = size.Edition,
                RequestedServiceObjectiveName = size.ServiceObjectiveLevel,
                ResourceGroupName = ResourceGroup.Name,
                ServerName = sqlServer.Name,
                Import = new DatabaseImportArgs()
                {
                    AdministratorLogin = username,
                    AdministratorLoginPassword = password,
                    AuthenticationType = "SQL",
                    StorageKey = storageAccount.PrimaryAccessKey,
                    StorageKeyType = "StorageAccessKey",
                    OperationMode = "Import",
                    StorageUri = exampleBlob.Url
                },
                Collation = DatabaseCollation
            }, new CustomResourceOptions() { Parent = this, DependsOn = new InputList<Resource>() { sqlServer, storageAccount, exampleBlob } });

            return Output.All(sqlServer.Name, exampleDatabase.Name, password).Apply(f=> $"Data Source={f[0]}.<http://database.windows.net;Initial|database.windows.net;Initial> Catalog={f[1]};User ID={username};Password={f[2]};");