Exemplo n.º 1
0
            "read": "true",
            "write": "false",
            "delete": "false",
            "list": "false",
            "add": "false",
            "create": "false"
        })
    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;")
Exemplo n.º 2
0
                        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={
                                       "tier": "Basic",
                                       "size": "B1",
                                   })

app_insights = appinsights.Insights(appname + '-' + env + '-ai',
                                    resource_group_name=resource_group.name,
                                    location=resource_group.location,
                                    application_type="web",
                                    retention_in_days=90)

webapp = appservice.AppService(appname + '-' + env + '-webapp',
                               resource_group_name=resource_group.name,
                               app_service_plan_id=app_service_plan.id,
                               app_settings={
                                   "ApplicationInsights:InstrumentationKey":
                                   app_insights.instrumentation_key,
                                   "APPINSIGHTS_INSTRUMENTATIONKEY":
                                   app_insights.instrumentation_key,
                               },
                               connection_strings=[{
                                   "name": "db",
                                   "type": "SQLAzure",
Exemplo n.º 3
0
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={
                                       "tier": "Basic",
                                       "size": "B1",
                                   })

app_insights = appinsights.Insights(
    name=appname + '-' + env + '-sql',  # bypass auto naming
    resource_name=appname + '-' + env + '-ai',
    resource_group_name=resource_group.name,
    location=resource_group.location,
    application_type="web",
    retention_in_days=90)

webapp = appservice.AppService(appname + '-' + env + '-webapp',
                               resource_group_name=resource_group.name,
                               app_service_plan_id=app_service_plan.id,
                               app_settings={
                                   "ApplicationInsights:InstrumentationKey":
                                   app_insights.instrumentation_key,
                                   "APPINSIGHTS_INSTRUMENTATIONKEY":
                                   app_insights.instrumentation_key,
                               },
                               connection_strings=[{
                                   "name": "db",
import pulumi
from pulumi_azure import core, storage, servicebus, appservice, appinsights
from isodate import Duration, duration_isoformat

# Create an Azure Resource Group
resource_group = core.ResourceGroup('serverless-scheduler',
                                    name='serverless-scheduler',
                                    location='EastUs')

app_insights = appinsights.Insights('serverless-scheduler-ai',
                                    name='serverless-scheduler-ai',
                                    resource_group_name=resource_group.name,
                                    location=resource_group.location,
                                    application_type='web')

# Create an Azure Service Bus namespace
sbnamespace = servicebus.Namespace('serverless-scheduler-demo',
                                   sku='Standard',
                                   name='serverless-scheduler-demo',
                                   location='EastUs',
                                   resource_group_name=resource_group.name)

# Create an associated queue within the above namespace
servicebus.Queue('scheduled-tweets',
                 name='scheduled-tweets',
                 namespace_name=sbnamespace.name,
                 dead_lettering_on_message_expiration=True,
                 resource_group_name=resource_group.name,
                 max_size_in_megabytes=1024,
                 default_message_ttl=duration_isoformat(Duration(days=5)))