This example configures Static website hosting in Azure Storage. One complication is the fact that the Static Website feature of Storage Accounts is not part of Azure Resource Manager, and is not configurable directly via Pulumi Azure provider.
As a workaround we use the Azure storage SDK to enable the feature directly in the C# code, while still providing the Pulumi experience and lifecycle management.
-
Create a new stack:
$ pulumi stack init dev
-
Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):
$ az login
-
Restore dotnet dependencies
$ dotnet restore
-
Run
pulumi up
to preview and deploy changes:$ pulumi up Previewing changes: ... Performing changes: ... Outputs: StaticEndpoint: "https://mysitebc97f8a0.z6.web.core.windows.net/" Resources: + 5 created Duration: 30s
-
Check the deployed website endpoint:
$ pulumi stack output StaticEndpoint https://mysitebc97f8a0.z6.web.core.windows.net/ $ curl "$(pulumi stack output StaticEndpoint)" <html> <body> <h1>This file is served from Blob Storage</h1> </body> </html>