config = Config() pwd = config.require("sqlPassword") resource_group = core.ResourceGroup("appservicerg") storage_account = storage.Account("appservicesa", resource_group_name=resource_group.name, account_kind="StorageV2", account_tier="Standard", account_replication_type="LRS") app_service_plan = appservice.Plan("appservice-asp", resource_group_name=resource_group.name, kind="App", sku={ "tier": "Basic", "size": "B1", }) storage_container = storage.Container( "appservice-c", storage_account_name=storage_account.name, container_access_type="private") blob = storage.Blob("appservice-b", storage_account_name=storage_account.name, storage_container_name=storage_container.name, type="Block", source=asset.FileArchive("wwwroot"))
print(location) resource_group = core.ResourceGroup('my_pulumi_resource_group', location=location) # Create an Azure resource (Storage Account) account = storage.Account( 'storage', # The location for the storage account will be derived automatically from the resource group. resource_group_name=resource_group.name, account_tier='Standard', account_replication_type='LRS') # play around with some resource groups and maybe a function? appService = appservice.Plan("appServicePlan", resource_group_name=resource_group.name, sku={ "tier": "free", "size": "F1" }) example_function = appservice.FunctionApp( "MyTestFunction", resource_group_name=resource_group.name, app_service_plan_id=appService.id, app_settings={"runtime": "python"}, storage_connection_string=account) # Export the connection string for the storage account pulumi.export('connection_string', account.primary_connection_string)
from pulumi_azure import core, appservice, containerservice from pulumi import export 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(
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", source=asset.FileAsset("./README.md")) app_service_plan = appservice.Plan("asp", resource_group_name=resource_group.name, kind="App", sku=appservice.PlanSkuArgs(tier="Basic", size="B1")) blob = storage.Blob( "zip", storage_account_name=storage_account.name, storage_container_name=container.name, type="Block", source=asset.FileArchive("./webapp/bin/Debug/netcoreapp3.1/publish")) client_config = core.get_client_config() tenant_id = client_config.tenant_id current_principal = client_config.object_id vault = keyvault.KeyVault(
"write": "false", "delete": "false", "add": "false", "list": "false", "create": "false", "update": "false", "process": "false" }, ) httpdotnet_signed_blob_url = Output.all(httpdotnet_storage_account.name, httpdotnet_container.name, httpdotnet_zib_blob.name, account_sas.sas) \ .apply(lambda args: f"https://{args[0]}.blob.core.windows.net/{args[1]}/{args[2]}{args[3]}") httpdotnet_plan = appservice.Plan("http-dotnet", resource_group_name=resource_group.name, kind="FunctionApp", sku={ "tier": "Dynamic", "size": "Y1" }) httpdotnet_function_app = appservice.FunctionApp( "http-dotnet", resource_group_name=resource_group.name, app_service_plan_id=httpdotnet_plan.id, storage_connection_string=httpdotnet_storage_account. primary_connection_string, version="~2", app_settings={ "runtime": "dotnet", "WEBSITE_NODE_DEFAULT_VERSION": "8.11.1", "WEBSITE_RUN_FROM_PACKAGE": httpdotnet_signed_blob_url,
from pulumi_azure import core, appservice, containerservice from pulumi import export, Output resource_group = core.ResourceGroup("samples") plan = appservice.Plan("linux-apps", resource_group_name=resource_group.name, kind="Linux", reserved="true", sku={ "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={ "always_on": "true", "linux_fx_version": "DOCKER|%s" % docker_image, }, https_only="true")
delete=False, list=False, add=False, create=False, )) return f"https://{args[0]}.blob.core.windows.net/{args[2]}/{args[3]}{blob_sas.sas}" http_signed_blob_url = Output.all( http_storage_account.name, http_storage_account.primary_connection_string, http_container.name, http_zib_blob.name).apply(get_sas) http_plan = appservice.Plan( "http", resource_group_name=resource_group.name, kind="Linux", sku=appservice.PlanSkuArgs(tier="Dynamic", size="Y1"), reserved=True, ) http_function_app = appservice.FunctionApp( "http", resource_group_name=resource_group.name, app_service_plan_id=http_plan.id, storage_account_name=http_storage_account.name, storage_account_access_key=http_storage_account.primary_access_key, version="~3", app_settings={ "FUNCTIONS_WORKER_RUNTIME": "python", "WEBSITE_RUN_FROM_PACKAGE": http_signed_blob_url, },
"delete": "false", "list": "false", "add": "false", "create": "false" }) return f"https://{args[0]}.blob.core.windows.net/{args[2]}/{args[3]}{blob_sas.sas}" http_signed_blob_url = Output.all( http_storage_account.name, http_storage_account.primary_connection_string, http_container.name, http_zib_blob.name).apply(get_sas) http_plan = appservice.Plan("http", resource_group_name=resource_group.name, kind="Linux", sku={ "tier": "Dynamic", "size": "Y1" }, reserved="true") http_function_app = appservice.FunctionApp( "http", resource_group_name=resource_group.name, app_service_plan_id=http_plan.id, storage_account_name=http_storage_account.name, storage_account_access_key=http_storage_account.primary_access_key, version="~3", app_settings={ "FUNCTIONS_WORKER_RUNTIME": "python", "WEBSITE_RUN_FROM_PACKAGE": http_signed_blob_url, },
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={ "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,
max_size_in_megabytes=1024, default_message_ttl=duration_isoformat(Duration(days=5))) # Create an Azure Storage Account scheduler_account = storage.Account('serverlessschedulerstore', name='serverlessschedulerstore', account_kind="StorageV2", resource_group_name=resource_group.name, account_tier='Standard', account_replication_type='LRS') scheduler_plan = appservice.Plan("serverless-scheduler", name='serverless-scheduler', resource_group_name=resource_group.name, kind="FunctionApp", reserved=True, sku={ "tier": "Dynamic", "size": "Y1" }) scheduler_app = appservice.FunctionApp( "serverless-scheduler", name="serverless-scheduler", resource_group_name=resource_group.name, app_service_plan_id=scheduler_plan.id, https_only=True, os_type="linux", # doesn't work?? storage_connection_string=scheduler_account.primary_connection_string, version="~3", app_settings={
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)