Пример #1
0
        })
    return f"https://{args[0]}.blob.core.windows.net/{args[2]}/{args[3]}{blob_sas.sas}"


signed_blob_url = Output.all(storage_account.name,
                             storage_account.primary_connection_string,
                             storage_container.name, blob.name).apply(get_sas)

app_insights = appinsights.Insights("appservice-ai",
                                    resource_group_name=resource_group.name,
                                    location=resource_group.location,
                                    application_type="web")

sql_server = sql.SqlServer("appservice-sql",
                           resource_group_name=resource_group.name,
                           administrator_login=username,
                           administrator_login_password=pwd,
                           version="12.0")

database = sql.Database("appservice-db",
                        resource_group_name=resource_group.name,
                        server_name=sql_server.name,
                        requested_service_objective_name="S0")

connection_string = Output.all(sql_server.name, database.name, username, pwd) \
    .apply(lambda args: f"Server=tcp:{args[0]}.database.windows.net;initial catalog={args[1]};user ID={args[2]};password={args[3]};Min Pool Size=0;Max Pool Size=30;Persist Security Info=true;")

app = appservice.AppService("appservice-as",
                            resource_group_name=resource_group.name,
                            app_service_plan_id=app_service_plan.id,
                            app_settings={
Пример #2
0
        admin_username=server_user,
        admin_password=pwd,
        name=config["name"],
        network_interface_ids=[nic.id],
        os_disk={
            "caching": "None",
            "storage_account_type": "Standard_LRS"
        },
        size=config["size"],
        source_image_reference=config["img"])
    vm_ids.append(vm.id)

# create azure sql server
sqlserver = sql.SqlServer("sso-sql",
                          resource_group_name=rg.name,
                          administrator_login="******",
                          administrator_login_password=sqlpwd,
                          version="12.0")

# create sql database
sqldb = sql.Database("sso-db",
                     resource_group_name=rg.name,
                     server_name=sqlserver.name,
                     edition="Standard",
                     requested_service_objective_name="S1")

# connection string (thanks Pulumi docs)
connection_string = Output.all(sqlserver.name, sqldb.name, sql_user, sqlpwd) \
    .apply(lambda args: f"Server=tcp:{args[0]}.database.windows.net;initial catalog={args[1]};user ID={args[2]};password={args[3]};Min Pool Size=0;Max Pool Size=30;Persist Security Info=true;")

# Export the connection string for the storage account
Пример #3
0
                                  account_replication_type="LRS",
                                  account_tier="Standard")

container = storage.Container("files",
                              storage_account_name=storage_account.name,
                              container_access_type="private")

administrator_login_password = random.RandomPassword(
    "password",
    length=16,
    special=True,
).result

sql_server = sql.SqlServer(
    "sqlserver",
    resource_group_name=resource_group.name,
    administrator_login_password=administrator_login_password,
    administrator_login="******",
    version="12.0")

database = sql.Database("sqldb",
                        resource_group_name=resource_group.name,
                        server_name=sql_server.name,
                        requested_service_objective_name="S0")

connection_string = Output.all(sql_server.name, database.name) \
    .apply(lambda args: f"Server=tcp:{args[0]}.database.windows.net;Database={args[1]};") or "1111"

text_blob = storage.Blob("text",
                         storage_account_name=storage_account.name,
                         storage_container_name=container.name,
                         type="Block",
Пример #4
0
from pulumi import Config, export, asset, Output
from pulumi_azure import core, storage, appservice, appinsights, sql

import pulumi
env = pulumi.get_stack()
appname = pulumi.get_project()

config = Config()
username = config.require("sqlUsername")
pwd = config.require("sqlPassword")

resource_group = core.ResourceGroup(appname + '-' + env + '-rg')

sql_server = sql.SqlServer(resource_name=appname + '-' + env + '-sql',
                           resource_group_name=resource_group.name,
                           administrator_login=username,
                           administrator_login_password=pwd,
                           version="12.0")

database = sql.Database(appname + '-' + env + '-db',
                        resource_group_name=resource_group.name,
                        server_name=sql_server.name,
                        requested_service_objective_name="S0")

connection_string = Output.all(sql_server.name, database.name, username, pwd) \
    .apply(lambda args: f"Server=tcp:{args[0]}.database.windows.net;initial catalog={args[1]};user ID={args[2]};password={args[3]};Min Pool Size=0;Max Pool Size=30;Persist Security Info=true;")

app_service_plan = appservice.Plan(appname + '-' + env + '-asp',
                                   resource_group_name=resource_group.name,
                                   kind="App",
                                   sku={