Пример #1
0
# Create a Storage Account
account = storage.StorageAccount('storageaccount',
                                 resource_group_name=resource_group.name,
                                 sku=storage.SkuArgs(
                                     name=storage.SkuName.STANDARD_LRS, ),
                                 kind=storage.Kind.STORAGE_V2)

# Create a consumption plan
# Consumption plan must be linux for python: https://docs.microsoft.com/en-us/azure/azure-functions/functions-scale#operating-systemruntime
plan = web.AppServicePlan(
    "consumption-plan",
    resource_group_name=resource_group.name,
    location=resource_group.location,
    kind="functionapp",
    reserved=
    True,  # This is an Azure Requirement for PYTHON. The function can only run on Linux. 
    sku=web.SkuDescriptionArgs(name="Y1",
                               tier="Dynamic",
                               size="Y1",
                               family="Y",
                               capacity=0))

# Export the Azure Resource Group
pulumi.export('resourcegroup', resource_group.name)

# Export the Storage Account
pulumi.export('storageaccount', account.name)

# Export the Consumption Plan
pulumi.export('consumptionplan', plan.name)
Пример #2
0
config = Config()
pwd = config.require("sqlPassword")

resource_group = resource.ResourceGroup("appservicerg")

storage_account = storage.StorageAccount(
    "appservicesa",
    resource_group_name=resource_group.name,
    kind=storage.Kind.STORAGE_V2,
    sku=storage.SkuArgs(name=storage.SkuName.STANDARD_LRS))

app_service_plan = web.AppServicePlan("appservice-asp",
                                      resource_group_name=resource_group.name,
                                      kind="App",
                                      sku=web.SkuDescriptionArgs(
                                          tier="Basic",
                                          name="B1",
                                      ))

storage_container = BlobContainer("appservice-c",
                                  account_name=storage_account.name,
                                  public_access=PublicAccess.NONE,
                                  resource_group_name=resource_group.name)

blob = storage.Blob("appservice-b",
                    resource_group_name=resource_group.name,
                    account_name=storage_account.name,
                    container_name=storage_container.name,
                    type=storage.BlobType.BLOCK,
                    source=asset.FileArchive("wwwroot"))

blob_sas = storage.list_storage_account_service_sas_output(
Пример #3
0
"""An Azure RM Python Pulumi program"""

import pulumi
from pulumi_azure_native import resources
from pulumi_azure_native import web

# Resource Group - https://www.pulumi.com/docs/reference/pkg/azure-native/resources/resourcegroup/
demo_resource_group = resources.ResourceGroup("rg-aelia-dev-westus2-001",
                                              location="West US 2")

# App Service Plan - https://www.pulumi.com/docs/reference/pkg/azure-native/web/appserviceplan/
demo_plan = web.AppServicePlan("sp-aelia-dev-westus2-001",
                               location=demo_resource_group.location,
                               resource_group_name=demo_resource_group.name,
                               kind="Linux",
                               reserved=True,
                               sku=web.SkuDescriptionArgs(tier="Free",
                                                          name="F1",
                                                          size="F1"))

# App Service - https://www.pulumi.com/docs/reference/pkg/azure-native/web/webapp/
demo_app_service = web.WebApp("app-aelia-dev-westus2-001",
                              location=demo_resource_group.location,
                              resource_group_name=demo_resource_group.name,
                              server_farm_id=demo_plan.id,
                              site_config={
                                  "linuxFxVersion":
                                  "DOCKER|ghcr.io/boredtweak/webapi:latest",
                                  "use32BitWorkerProcess": True,
                              })