pulumi.Output.secret(storageConnectionString)) # Create the functionapp app = web.WebApp( "functionapp", resource_group_name=resource_group.name, location=resource_group.location, kind="functionapp", reserved=True, server_farm_id=plan.id, site_config=web.SiteConfigArgs(app_settings=[ web.NameValuePairArgs(name="runtime", value="python"), web.NameValuePairArgs(name="FUNCTIONS_WORKER_RUNTIME", value="python"), web.NameValuePairArgs(name="FUNCTIONS_EXTENSION_VERSION", value="~3"), web.NameValuePairArgs(name="AzureWebJobsStorage", value=storageConnectionString), web.NameValuePairArgs( name="WEBSITE_RUN_FROM_PACKAGE", value= "https://github.com/tusharshahrs/demo/raw/main/content/lab/pulumi/azure-native/python/app/HelloWithPython.zip" ), ], )) # Export the function pulumi.export('function_app', app.name) # Full endpoint of your Function App function_endpoint = app.default_host_name.apply( lambda default_host_name: f"https://{default_host_name}/api/HelloWithPython") pulumi.export('endpoint', function_endpoint)
connection_string = Output.concat( "Server=tcp:", sql_server.name, ".database.windows.net;initial ", "catalog=", database.name, ";user ID=", username, ";password="******";Min Pool Size=0;Max Pool Size=30;Persist Security Info=true;") app = web.WebApp( "appservice-as", resource_group_name=resource_group.name, server_farm_id=app_service_plan.id, site_config=web.SiteConfigArgs(app_settings=[ web.NameValuePairArgs(name="APPINSIGHTS_INSTRUMENTATIONKEY", value=app_insights.instrumentation_key), web.NameValuePairArgs(name="APPLICATIONINSIGHTS_CONNECTION_STRING", value=app_insights.instrumentation_key.apply( lambda key: "InstrumentationKey=" + key)), web.NameValuePairArgs( name="ApplicationInsightsAgent_EXTENSION_VERSION", value="~2"), web.NameValuePairArgs(name="WEBSITE_RUN_FROM_PACKAGE", value=signed_blob_url) ], connection_strings=[ web.ConnStringInfoArgs( name="db", type="SQLAzure", connection_string=connection_string, ) ])) export("endpoint", app.default_host_name.apply(lambda endpoint: "https://" + endpoint))
# # Scenario 1: deploying an image from Docker Hub. # The example uses a HelloWorld application written in Go. # Image: https://hub.docker.com/r/microsoft/azure-appservices-go-quickstart/ # image_in_docker_hub = "microsoft/azure-appservices-go-quickstart" hello_app = web.WebApp("helloApp", resource_group_name=resource_group.name, server_farm_id=plan.id, site_config=web.SiteConfigArgs( app_settings=[ web.NameValuePairArgs( name="WEBSITES_ENABLE_APP_SERVICE_STORAGE", value="false") ], always_on=True, linux_fx_version=f"DOCKER|{image_in_docker_hub}", ), https_only=True) pulumi.export( "helloEndpoint", hello_app.default_host_name.apply( lambda default_host_name: f"https://{default_host_name}/hello")) # # Scenario 2: deploying a custom image from Azure Container Registry. # custom_image = "node-app"