export async function createSql()

in src/resources/sql.ts [28:53]


export async function createSql(info: ResourceInfo): Promise<void> {
    const serverName = getSqlAccountName(info);
    const armClient = new SqlManagementClient(info.creds, info.subscriptionId);
    const password = await createSecret(info, sqlSecretName);
    await armClient.servers.beginCreateOrUpdateAndWait(info.resourceGroupName, serverName, {
        location: info.location,
        administratorLogin: info.userName,
        administratorLoginPassword: password,
    });

    const [startIpAddress, endIpAddress] = await getPublicIpAddress();
    console.log(`Adding ip address "${startIpAddress}"-"${endIpAddress}" to sql firewall rule.`);
    await armClient.firewallRules.createOrUpdate(info.resourceGroupName, serverName, 'e2eTestFirewall', {
        startIpAddress,
        endIpAddress,
    });
    await armClient.databases.beginCreateOrUpdateAndWait(info.resourceGroupName, serverName, dbName, {
        location: info.location,
        sku: {
            name: 'GP_S_Gen5_1',
            tier: 'GeneralPurpose',
        },
    });

    await runSetupQueries(info);
}