B2C Tenant

Overview

Creates a new B2C tenant, please note that the current implementation only supports the creation of a new B2C tenant.

Usage of this computation expression when a B2C tenant already exists will result in an error, check the example for more infos.

B2C Tenant Builder Keywords

Applies ToKeywordPurpose
B2C Tenantinitial_domain_nameInitial domain name for the B2C tenant as in initial_domain_name.onmicrosoft.com
B2C Tenantdisplay_nameDisplay name for the B2C tenant.
B2C TenantskuSKU for the B2C tenant.
B2C Tenantcountry_codeCountry code defined by two capital letter, for examples check the official [docs](https://learn.microsoft.com/en-us/azure/active-directory-b2c/data-residency]
B2C Tenantdata_residencyData residency for the B2C tenant, for more infos check the official [docs](https://learn.microsoft.com/en-us/azure/active-directory-b2c/data-residency]
B2C TenanttagsTags for the B2C tenant.

Example

Basic creation of a B2C tenant, while avoiding having an error when such tenant already exists.

open Farmer
open Farmer.B2cTenant
open Farmer.Builders
open Farmer.Deploy

let initialDomainName = "myb2c"

let myb2c =
    b2cTenant {
        initial_domain_name initialDomainName
        display_name "My B2C"
        sku Sku.PremiumP1
        country_code "FR"
        data_residency B2cDataResidency.Europe
    }
    
let b2cDoesNotExist (initialDomainName: string) =
    let output =
        Az.AzHelpers.executeAz $"resource list --name '{initialDomainName}.onmicrosoft.com'"
        |> snd
    not (output.Contains initialDomainName)
    
let deployment =
    arm {
        location Location.FranceCentral
        add_resources
            [
                // This allows to avoid having an error when the B2C tenant already exists
                if b2cDoesNotExist initialDomainName then
                    myb2c
            ]
    }