1. How to declare Azure Front Door premium in Azure-native?


    The Azure Front Door (Premium and Standard) uses resources from both the network and cdn namespaces. The main resource is azure-native.network.FrontDoor, and it connects to back-end pools, routing rules, and front-end endpoints.

    Here is an example of how to declare an Azure Front Door Premium instance. This program creates a Front Door with one Backend, one BackendPool, one RoutingRule, and one FrontendEndpoint.

    To create this, you are required to provide your own resource group.

    import * as pulumi from "@pulumi/pulumi"; import * as azure_native from "@pulumi/azure-native"; // Backend instance const backend = new azure_native.network.FrontDoorBackend("backendInstance", { backendHostHeader: "backendhost", httpPort: 80, httpsPort: 443, priority: 1, weight: 50, }); // Backend pool instance const backendPool = new azure_native.network.FrontDoorBackendPool("backendPoolInstance", { backends: [{ address: backend.id, httpPort: 80, weight: 1, priority: 1, }], }); // Routing rule instance const routingRule = new azure_native.network.FrontDoorRoutingRule("routingRuleInstance", { frontendEndpoints: [{ id: frontendEndpoint.name, }], routeConfiguration: { backendPools: [{ id: backendPool.id, }], }, }); // Frontend endpoint instance const frontendEndpoint = new azure_native.network.FrontDoorFrontendEndpoint("frontendEndpointInstance", { hostName: "contoso.azurefd.net", }); // Front Door instance const frontdoor = new azure_native.network.FrontDoor("frontdoorInstance", { backendPools: [{ id: backendPool.id, }], frontendEndpoints: [{ id: frontendEndpoint.id, }], routingRules: [{ id: routingRule.id, }], });

    This is a simple instance of Front Door. Depending on your requirements, FrontDoor can be as complex as your architecture needs.

    Each of the resources created above represents what can be visualized as tabs in the Azure Portal skin for Front Door. Those resources include:

    • Backend: Represents a physical endpoint where a Front Door can route traffic to. This can be an App service, a CIDR block, an API Management service, or a storage account, for example.
    • Backend Pool: Is a logical group of backends that a given Route (Routing Rule) can route traffic to.
    • Routing Rules: Define a combination of a pattern that a frontendListener monitors and an action to take when a route matches the path.
    • Frontend Endpoint: Can be any custom domain associated with the Front Door, or the default endpoint (with azurefd.net at the end).
    • Health Probes and Load Balancing: These two settings can be associated with the Backend Pool and affect the routing decisions and availability of the endpoints.

    Please note that the above code is a simple declarative representation of Front Door resources. The ids and parameters are abstracted for understanding purposes, you need to replace them with valid existing ids and parameters according to your setup.

    For full examples and additional details about Azure Front Door configuration and properties, refer to the Azure Front Door Documentation.