Пример #1
0
                         key_vault_id=vault.id,
                         value=signed_blob_url)

secret_uri = Output.all(vault.vault_uri, secret.name, secret.version) \
    .apply(lambda args: f"{args[0]}secrets/{args[1]}/{args[2]}")

app = appservice.AppService(
    "app",
    resource_group_name=resource_group.name,
    app_service_plan_id=app_service_plan.id,
    identity=appservice.AppServiceIdentityArgs(type="SystemAssigned", ),
    app_settings={
        "WEBSITE_RUN_FROM_ZIP":
        secret_uri.apply(
            lambda args: "@Microsoft.KeyVault(SecretUri=" + args + ")"),
        "StorageBlobUrl":
        text_blob.url,
    },
    connection_strings=[
        appservice.AppServiceConnectionStringArgs(
            name="db",
            value=connection_string,
            type="SQLAzure",
        )
    ])

## Work around a preview issue https://github.com/pulumi/pulumi-azure/issues/192
principal_id = app.identity.apply(
    lambda id: id.principal_id or "11111111-1111-1111-1111-111111111111")

policy = keyvault.AccessPolicy("app-policy",
Пример #2
0
                           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={
                                "WEBSITE_RUN_FROM_PACKAGE":
                                signed_blob_url,
                                "ApplicationInsights:InstrumentationKey":
                                app_insights.instrumentation_key,
                                "APPINSIGHTS_INSTRUMENTATIONKEY":
                                app_insights.instrumentation_key,
                            },
                            connection_strings=[{
                                "name": "db",
                                "type": "SQLAzure",
                                "value": connection_string
                            }])

export("endpoint",
       app.default_site_hostname.apply(lambda endpoint: "https://" + endpoint))
Пример #3
0
                         key_vault_id=vault.id,
                         value=signed_blob_url)

secret_uri = Output.all(vault.vault_uri, secret.name, secret.version) \
    .apply(lambda args: f"{args[0]}secrets/{args[1]}/{args[2]}")

app = appservice.AppService(
    "app",
    resource_group_name=resource_group.name,
    app_service_plan_id=app_service_plan.id,
    identity={
        "type": "SystemAssigned",
    },
    app_settings={
        "WEBSITE_RUN_FROM_ZIP":
        secret_uri.apply(
            lambda args: "@Microsoft.KeyVault(SecretUri=" + args + ")"),
        "StorageBlobUrl":
        text_blob.url
    },
    connection_strings=[{
        "name": "db",
        "value": connection_string,
        "type": "SQLAzure"
    }])

## Work around a preview issue https://github.com/pulumi/pulumi-azure/issues/192
principal_id = app.identity[
    "principal_id"] or "11111111-1111-1111-1111-111111111111"

policy = keyvault.AccessPolicy("app-policy",
Пример #4
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={
                                "APPINSIGHTS_INSTRUMENTATIONKEY":
                                app_insights.instrumentation_key,
                                "APPLICATIONINSIGHTS_CONNECTION_STRING":
                                app_insights.instrumentation_key.apply(
                                    lambda key: "InstrumentationKey=" + key),
                                "ApplicationInsightsAgent_EXTENSION_VERSION":
                                "~2",
                                "WEBSITE_RUN_FROM_PACKAGE":
                                signed_blob_url,
                            },
                            connection_strings=[{
                                "name": "db",
                                "type": "SQLAzure",
                                "value": connection_string
                            }])

export("endpoint",
       app.default_site_hostname.apply(lambda endpoint: "https://" + endpoint))
Пример #5
0
resource_group = core.ResourceGroup("samples")

plan = appservice.Plan(
    "linux-apps",
    resource_group_name=resource_group.name,
    kind="Linux",
    reserved=True,
    sku=appservice.PlanSkuArgs(
        tier="Basic",
        size="B1",
    ))

docker_image = "microsoft/azure-appservices-go-quickstart"

hello_app = appservice.AppService(
    "hello-app",
    resource_group_name=resource_group.name,
    app_service_plan_id=plan.id,
    app_settings={
        "WEBSITES_ENABLE_APP_SERVICE_STORAGE": "false",
    },
    site_config=appservice.AppServiceSiteConfigArgs(
        always_on=True,
        linux_fx_version="DOCKER|%s" % docker_image,
    ),
    https_only=True)

export("hello_endpoint", hello_app.default_site_hostname.apply(
    lambda endpoint: "https://" + endpoint + "/hello"
))
Пример #6
0
                                   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",
                                   "type": "SQLAzure",
                                   "value": connection_string
                               }])

export(
    "endpoint",
    webapp.default_site_hostname.apply(lambda endpoint: "https://" + endpoint))
Пример #7
0
import pulumi
from pulumi_azure import core, storage, appservice

# Resource Group
pulumi_rg = core.ResourceGroup('pulumi_rg')

# App Service Plan
pulumi_plan = appservice.Plan("pulumiPlan",
                              location=pulumi_rg.location,
                              resource_group_name=pulumi_rg.name,
                              sku=appservice.PlanSkuArgs(
                                  tier="Standard",
                                  size="S1",
                              ))

# Web App
pulumi_app_service = appservice.AppService(
    "pulumiAppService",
    location=pulumi_rg.location,
    resource_group_name=pulumi_rg.name,
    app_service_plan_id=pulumi_plan.id,
    app_settings={
        "ENVIRONMENT": "dev",
    },
)

# Export the hostname for the web app
pulumi.export('hostname', pulumi_app_service.default_site_hostname)