Cannot create resource with location: 'United States'. Please use location: 'Europe' to create resource for b2b directory:

Paweł Bołdyn 0 Reputation points
2024-12-11T12:14:43.5733333+00:00

Hey!
I'm trying to link a tenant to my subscription. When I try, I receive this error:
Cannot create resource with location: 'United States'. Please use location: 'Europe' to create resource for b2b directory: 'mytenat'

The subscription is in my directory (I'm the owner).
The resource group is created in West Europe.
The tenant is in the European Union.

User's image

Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,966 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,644 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Paweł Bołdyn 0 Reputation points
    2024-12-18T14:02:09.6666667+00:00

    It seems like when using the Azure Portal web site, the region will be set as “United State” by default.

    Connect-AzAccount
    $token = (Get-AzAccessToken).Token
    $uri = "https://management.azure.com/subscriptions/{SUBSCRIPTIONID}/resourceGroups/{RESOURCEGROUP}/providers/Microsoft.AzureActiveDirectory/guestUsages/{TENANTNAME}.onmicrosoft.com?api-version=2020-05-01-preview"
    
    $body = @{
        id         = "/subscriptions/{SUBSCRIPTIONID}/resourceGroups/{RESOURCEGROUP}/providers/Microsoft.AzureActiveDirectory/guestUsages/{TENANTNAME}.onmicrosoft.com"
        name       = "{TENANTNAME}.onmicrosoft.com"
        location   = "Europe"
        tags       = @{}
        type       = "Microsoft.AzureActiveDirectory/GuestUsages"
        properties = @{
            tenantId = "{TENANTID}"
        }
    }
    
    $headers = @{
        Authorization = "Bearer $Bearer"
    }
    
    Invoke-RestMethod -Uri $uri -Method Put -Body ($body | ConvertTo-Json -Depth 10) -ContentType "application/json" -Headers $headers
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.