Edit

Share via


Connect a verified email ___domain to send email

This article describes how to connect a verified ___domain in Azure Communication Services to send email.

Prerequisites

Connect an email ___domain to a Communication Service Resource

  1. In the Azure Communication Service Resource overview page, in the left navigation panel under Email, click Domains.

    Screenshot that shows the left navigation panel for linking Email Domains.

  2. Select one of the following options:

    • From the upper navigation bar, click Connect ___domain.

    • From the splash screen, click Connect ___domain.

      Screenshot that shows how to connect one of your verified email domains.

  3. Select one of the verified domains by filtering:

    • Subscription
    • Resource Group
    • Email Service
    • Verified Domain

    Screenshot that shows how to filter and select one of the verified email domains to connect.

Note

You can only connect domains in the same geography. Make sure that the Data ___location for Communication Resource and Email Communication Resource you selected during resource creation are in the same geography.

  1. Click Connect.

    Screenshot that shows one of the verified email domains is now connected.

Note

We enable customers to link up to 100 custom domains to a single communication service resource. All Mail-From addresses configured under these custom domains are accessible for the communication service resource. You can only link verified custom domains.

Disconnect an email ___domain from the Communication Service Resource

  1. In the Azure Communication Services Resource overview page, from the left navigation panel under Email, click Domains.

  2. Select the Connected Domains, then click ... and select Disconnect.

    Screenshot that shows how to disconnect the connected ___domain.

Prerequisites

Connect an email ___domain to a Communication Service Resource

Replace the {subscription-id}, {resource-group-name}, {communication-services-resource-name}, and {linked-___domain-resource-id} in the sample request.

Format the linked ___domain resource ID as follows:

/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Communication/emailServices/{email-service-name}/domains/{___domain-name}

If you're using an Azure Managed Domain, the ___domain-name is AzureManagedDomain. The email-service-name must be the same email service that you used to provision the ___domain.

Once these values are populated, make a PATCH request using the following Request URL and body.

https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Communication/CommunicationServices/{communication-services-resource-name}?api-version=2023-03-31
{
    "properties": {
        "linkedDomains": ["{linked-___domain-resource-id}"]
    }
}

Disconnect an email ___domain from the Communication Service Resource

Replace the {subscription-id}, {resource-group-name}, and {communication-services-resource-name} in the sample request.

Once these values are populated, make a PATCH request using the following Request URL and body.

https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Communication/CommunicationServices/{communication-services-resource-name}?api-version=2023-03-31
{
    "properties": {
        "linkedDomains": []
    }
}

Prerequisites

Install the required packages

dotnet add package Azure.ResourceManager.Communication

Initialize the management client

Set the environment variable AZURE_SUBSCRIPTION_ID with the subscription ID of the subscription your Domain and Email resources are in. Run the code sample to initialize the management client.

using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Compute;
using Azure.ResourceManager.Resources;

ArmClient client = new ArmClient(new DefaultAzureCredential());

Connect an email ___domain to a Communication Service Resource

Replace the <subscription-id>, <resource-group-name>, <azure-communication-services-resource-name>, and <linked-___domain-resource-id> in the sample code.

Format the linked ___domain resource ID as follows:

/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Communication/emailServices/<email-service-name>/domains/<___domain-name>

If you're using an Azure Managed Domain, the ___domain-name is "AzureManagedDomain." The email-service-name should be the same email service that you used to provision the ___domain.

Once these values are populated, run the sample code.

ResourceIdentifier communicationServiceResourceId = CommunicationServiceResource.CreateResourceIdentifier("<subscription-id>", "<resource-group-name>", "<azure-communication-services-resource-name>");
CommunicationServiceResource communicationServiceResource = client.GetCommunicationServiceResource(communicationServiceResourceId);

CommunicationServiceResourcePatch patch = new CommunicationServiceResourcePatch()
{
    LinkedDomains =
    {
        "<linked-___domain-resource-id>",
    },
};
CommunicationServiceResource result = await communicationServiceResource.UpdateAsync(patch);

Disconnect an email ___domain from the Communication Service Resource

Replace the <subscription-id>, <resource-group-name>, and <azure-communication-services-resource-name> in the sample code.

Once these values are populated, run the sample code.

ResourceIdentifier communicationServiceResourceId = CommunicationServiceResource.CreateResourceIdentifier("<subscription-id>", "<resource-group-name>", "<azure-communication-services-resource-name>");
CommunicationServiceResource communicationServiceResource = client.GetCommunicationServiceResource(communicationServiceResourceId);

CommunicationServiceResourcePatch patch = new CommunicationServiceResourcePatch();
patch.LinkedDomains.Clear();
CommunicationServiceResource result = await communicationServiceResource.UpdateAsync(patch);

Prerequisites

Install the required packages

npm install @azure/arm-communication
npm install @azure/identity

Initialize the management client

Replace the field in the sample code with the subscription ID of the subscription your Domain and Email resources are in. Run the code sample to initialize the management client.

const { CommunicationServiceManagementClient } = require("@azure/arm-communication");
const { DefaultAzureCredential } = require("@azure/identity");

const credential = new DefaultAzureCredential();
const subscriptionId = "<your-subscription-id>";

client = new CommunicationServiceManagementClient(credential, subscriptionId);

Connect an email ___domain to a Communication Service Resource

Replace the <resource-group-name>, <azure-communication-services-resource-name>, and <linked-___domain-resource-id> in the sample code.

Format the linked ___domain resource ID as follows:

/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Communication/emailServices/<email-service-name>/domains/<___domain-name>

If you're using an Azure Managed Domain, the ___domain-name is "AzureManagedDomain. The email-service-name should be the same email service that you used to provision the ___domain.

Once these values are populated, run the sample code.

const parameters = {
    dataLocation: "United States",
    ___location: "Global",
    linkedDomains: [
        "<linked-___domain-resource-id>"
    ]
};

const result = await client.communicationServices.beginCreateOrUpdateAndWait(
    "<resource-group-name>",
    "<azure-communication-services-resource-name>",
    parameters
);

Disconnect an email ___domain from the Communication Service Resource

Replace the <resource-group-name>, and <azure-communication-services-resource-name> in the sample code.

Once these values are populated, run the sample code.

const parameters = {
    dataLocation: "United States",
    ___location: "Global"
};

const result = await client.communicationServices.beginCreateOrUpdateAndWait(
    "<resource-group-name>",
    "<azure-communication-services-resource-name>",
    parameters
);

Prerequisites

Install the required packages

Add the following dependency to your pom.xml.

<dependency>
    <groupId>com.azure.resourcemanager</groupId>
    <artifactId>azure-resourcemanager-communication</artifactId>
    <version>2.0.0</version>
</dependency>

Initialize the management client

Set the environment variable AZURE_SUBSCRIPTION_ID with the subscription ID of the subscription your Domain and Email resources are in. Run the code sample to initialize the management client.

AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
TokenCredential credential = new DefaultAzureCredentialBuilder()
    .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint())
    .build();
CommunicationManager manager = CommunicationManager
    .authenticate(credential, profile);

Connect an email ___domain to a Communication Service Resource

Replace the <resource-group-name>, <azure-communication-services-resource-name>, and <linked-___domain-resource-id> in the sample code.

The linked ___domain resource ID must be in the following format.

/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Communication/emailServices/<email-service-name>/domains/<___domain-name>

If you're using an Azure Managed Domain, the ___domain-name is AzureManagedDomain. The email-service-name must be the same email service that you used to provision the ___domain.

Once these values are populated, run the sample code.

List<String> linkedDomains = new ArrayList<>();
linkedDomains.add("<linked-___domain-resource-id>") 

manager
    .communicationServices()
    .define("<azure-communication-services-resource-name>")
    .withRegion("Global")
    .withExistingResourceGroup("<resource-group-name>")
    .withDataLocation("United States")
    .withLinkedDomains(linkedDomains)
    .create();

Disconnect an email ___domain from the Communication Service Resource

Replace the <resource-group-name>, and <azure-communication-services-resource-name> in the sample code.

Once these values are populated, run the sample code.

manager
    .communicationServices()
    .define("<azure-communication-services-resource-name>")
    .withRegion("Global")
    .withExistingResourceGroup("<resource-group-name>")
    .withDataLocation("United States")
    .create();

Prerequisites

Install the required packages

pip install azure-mgmt-communication
pip install azure-identity

Initialize the management client

Replace the field in the sample code with the subscription ID of the subscription your Domain and Email resources are in. Run the code sample to initialize the management client.

from azure.mgmt.communication import CommunicationServiceManagementClient
from azure.identity import DefaultAzureCredential

credential = DefaultAzureCredential()
subscription_id = "<your-subscription-id>"

client = CommunicationServiceManagementClient(credential, subscription_id)

Connect an email ___domain to a Communication Service Resource

Replace the <resource-group-name>, <azure-communication-services-resource-name>, and <linked-___domain-resource-id> in the sample code.

The linked ___domain resource ID must be in the following format.

/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Communication/emailServices/<email-service-name>/domains/<___domain-name>

If you're using an Azure Managed Domain, the ___domain-name is AzureManagedDomain. The email-service-name must be the same email service that you used to provision the ___domain.

Once these values are populated, run the sample code.


response = client.communication_services.begin_create_or_update(
    resource_group_name="<resource-group-name>",
    communication_service_name="<azure-communication-services-resource-name>",
    parameters={
        "___location": "Global",
        "properties": {
            "dataLocation": "United States",
            "linkedDomains": [
                "<linked-___domain-resource-id>"
            ],
        }
    },
).result()

Disconnect an email ___domain from the Communication Service Resource

Replace the <resource-group-name> and <azure-communication-services-resource-name> in the sample code.

Once these values are populated, run the sample code.


response = client.communication_services.begin_create_or_update(
    resource_group_name="<resource-group-name>",
    communication_service_name="<azure-communication-services-resource-name>",
    parameters={
        "___location": "Global",
        "properties": {
            "dataLocation": "United States"
        }
    },
).result()

Next steps