Delen via


Quickstart: Resources voor e-mailcommunicatieservice maken en beheren

Ga aan de slag met e-mail door uw eerste Resource voor e-mailcommunicatieservice in te richten. E-mailcommunicatieservice-resources inrichten via Azure Portal of met behulp van de .NET-beheerclientbibliotheek. Met de beheerclientbibliotheek en Azure Portal kunt u uw resources en interface maken, configureren, bijwerken en verwijderen met behulp van de implementatie- en beheerservice van Azure: Azure Resource Manager. Alle functies die beschikbaar zijn in de clientbibliotheken, zijn beschikbaar in Azure Portal.

Waarschuwing

Houd er rekening mee dat het niet mogelijk is om tegelijkertijd een resourcegroep te maken als een resource voor Azure Communication Services. Wanneer u een resource maakt, moet er al een resourcegroep worden gebruikt die is gemaakt.

Vereisten

De e-mailcommunicatieserviceresource maken met behulp van de portal

  1. Open Azure Portal om een nieuwe resource te maken.

  2. Zoek naar e-mailcommunicatieservices.

    Schermopname die laat zien hoe u e-mailcommunicatieservice op de markt kunt zoeken.

  3. Selecteer E-mailcommunicatieservices en druk op Maken

    Schermopname van de koppeling Maken om e-mailcommunicatieservice te maken.

  4. Voer de vereiste gegevens in op het tabblad Basisbeginselen:

    • Selecteer een bestaand Azure-abonnement.

    • Selecteer een bestaande resourcegroep of maak een nieuwe resourcegroep door op de koppeling Nieuwe maken te klikken.

    • Geef een geldige naam op voor de resource.

    • Selecteer de regio waar de resource beschikbaar moet zijn.

    • Selecteer Verenigde Staten als de gegevenslocatie.

    • Als u tags wilt toevoegen, klikt u op Volgende: Tags

    • Voeg eventuele naam-/waardeparen toe.

      Schermopname die laat zien hoe u de samenvatting kunt bekijken en e-mailcommunicatieservice kunt maken.

  5. Klik op Volgende: Controleren en maken.

  6. Wacht totdat de validatie is geslaagd en klik vervolgens op Maken.

  7. Wacht tot de implementatie is voltooid en klik vervolgens op Ga naar resource om het overzicht van de e-mailcommunicatieservice te openen.

    Schermopname van het overzicht van de resource e-mailcommunicatieservice.

Vereisten

E-mail Communication Services-resource maken

Meld u aan bij Azure CLI om een E-mail Communication Services-resource te maken. U kunt zich aanmelden bij het uitvoeren van de az login opdracht vanuit de terminal en uw referenties opgeven. Voer de volgende opdracht uit om de resource te maken:

az communication email create --name "<EmailServiceName>" --location "Global" --data-location "United States" --resource-group "<resourceGroup>"

Als u een specifiek abonnement wilt selecteren, kunt u ook de --subscription vlag opgeven en de abonnements-id opgeven.

az communication email create --name "<EmailServiceName>" --location "Global" --data-location "United States" --resource-group "<resourceGroup>" --subscription "<subscriptionId>"

U kunt uw E-mail Communication Services-resource configureren met de volgende opties:

  • De resourcegroep
  • De naam van de resource e-mailcommunicatieservices
  • De geografie waaraan de resource wordt gekoppeld

In de volgende stap kunt u tags toewijzen aan de resource. Tags kunnen worden gebruikt om uw Azure Email-resources te organiseren. Zie de documentatie voor het taggen van resources voor meer informatie over tags.

Uw E-mail Communication Services-resource beheren

Voer de volgende opdrachten uit om tags toe te voegen aan uw E-mail Communication Services-resource. U kunt ook een specifiek abonnement instellen.

az communication email update --name "<EmailServiceName>" --tags newTag="newVal1" --resource-group "<resourceGroup>"

az communication email update --name "<EmailServiceName>" --tags newTag="newVal2" --resource-group "<resourceGroup>" --subscription "<subscriptionId>"

Als u alle resources van uw e-mailcommunicatieservice in een bepaalde resourcegroep wilt weergeven, gebruikt u de volgende opdracht:

az communication email list --resource-group "<resourceGroup>"

Gebruik de volgende opdracht om alle informatie over een bepaalde e-mailcommunicatieserviceresource weer te geven. U kunt ook een specifiek abonnement instellen.

az communication email show --name "<EmailServiceName>" --resource-group "<resourceGroup>"

az communication email show --name "<EmailServiceName>" --resource-group "<resourceGroup>" --subscription "<subscriptionId>"

Resource opschonen

Als u een e-mail communication services-abonnement wilt opschonen en verwijderen, kunt u de resource of resourcegroep verwijderen. U kunt uw e-mailcommunicatieresource verwijderen door de volgende opdracht uit te voeren.

az communication email delete --name "<EmailServiceName>" --resource-group "<resourceGroup>"

Als u de resourcegroep verwijdert, worden ook alle andere resources verwijderd die eraan zijn gekoppeld.

Notitie

Het verwijderen van resources is permanent en er kunnen geen gegevens, waaronder event grid-filters, telefoonnummers of andere gegevens die aan uw resource zijn gekoppeld, worden hersteld als u de resource verwijdert.

Zie De CLI voor e-mailcommunicatie voor meer informatie over andere opdrachten.

Vereisten

De SDK installeren

Neem eerst de Communication Services Management SDK op in uw C#-project:

using Azure.ResourceManager.Communication;

Abonnements-id

U hebt de ID van uw Azure-abonnement nodig. U vindt deze in het portaal:

  1. Meld u aan bij uw Azure-account
  2. Selecteer Abonnementen in de zijbalk aan de linkerzijde
  3. Selecteer het abonnement dat u nodig hebt
  4. Klik op Overzicht
  5. Selecteer uw Abonnements-ID

In deze quickstart wordt ervan uitgegaan dat u de abonnements-ID hebt opgeslagen in een omgevingsvariabele met de naam AZURE_SUBSCRIPTION_ID.

Verificatie

Als u wilt communiceren met Azure Communication Services, moet u zichzelf eerst verifiëren bij Azure.

De client verifiëren

De standaardoptie voor het maken van een geverifieerde client is het gebruik van DefaultAzureCredential. Aangezien alle beheer-API's hetzelfde eindpunt doorlopen om te kunnen communiceren met resources, moet er slechts één ArmClient op het hoogste niveau worden gemaakt.

Voer de volgende code uit om te verifiëren bij Azure en een ArmClient te maken:

using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Communication;
using Azure.ResourceManager.Resources;
...
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);

Interactie met Azure-resources

Nu u bent geverifieerd.

Voor elk van de volgende voorbeelden wijzen we onze e-mailservicesresources toe aan een bestaande resourcegroep.

Als u een resourcegroep wilt maken, kunt u dit doen met behulp van Azure Portal of de Azure Resource Manager SDK.

Een e-mailserviceresource maken

Wanneer u een e-mailserviceresource maakt, geeft u de naam en resourcenaam van de resourcegroep op.

Notitie

De Location eigenschap is altijd global, en tijdens de openbare preview moet de DataLocation waarde zijn UnitedStates.

// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);

// get the collection of this EmailServiceResource
EmailServiceResourceCollection collection = resourceGroupResource.GetEmailServiceResources();

// invoke the operation
string emailServiceName = "MyEmailServiceResource";
EmailServiceResourceData data = new EmailServiceResourceData(new AzureLocation("Global"))
{
    DataLocation = "United States",
};
ArmOperation<EmailServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, emailServiceName, data);
EmailServiceResource result = lro.Value;

// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
EmailServiceResourceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");

Uw E-mail Communication Services-resource beheren

Een E-mail Communication Services-resource bijwerken

...
// this example assumes you already have this EmailServiceResource created on azure
// for more information of creating EmailServiceResource, please refer to the document of EmailServiceResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
string emailServiceName = "MyEmailServiceResource";
ResourceIdentifier emailServiceResourceId = EmailServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName);
EmailServiceResource emailServiceResource = client.GetEmailServiceResource(emailServiceResourceId);

// invoke the operation
EmailServiceResourcePatch patch = new EmailServiceResourcePatch()
{
    Tags =
    {
    ["newTag"] = "newVal",
    },
};
ArmOperation<EmailServiceResource> lro = await emailServiceResource.UpdateAsync(WaitUntil.Completed, patch);
EmailServiceResource result = lro.Value;

// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
EmailServiceResourceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");

Alle e-mailcommunicatieserviceresources per resourcegroep weergeven

// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);

// get the collection of this EmailServiceResource
EmailServiceResourceCollection collection = resourceGroupResource.GetEmailServiceResources();

// invoke the operation and iterate over the result
await foreach (EmailServiceResource item in collection.GetAllAsync())
{
    // the variable item is a resource, you could call other operations on this instance as well
    // but just for demo, we get its data from this resource instance
    EmailServiceResourceData resourceData = item.Data;
    // for demo we just print out the id
    Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}

Console.WriteLine($"Succeeded");

Alle resources van de e-mailcommunicatieservice per abonnement weergeven

// this example assumes you already have this SubscriptionResource created on azure
// for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);

// invoke the operation and iterate over the result
await foreach (EmailServiceResource item in subscriptionResource.GetEmailServiceResourcesAsync())
{
    // the variable item is a resource, you could call other operations on this instance as well
    // but just for demo, we get its data from this resource instance
    EmailServiceResourceData resourceData = item.Data;
    // for demo we just print out the id
    Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}

Console.WriteLine($"Succeeded");

Resource opschonen

// this example assumes you already have this EmailServiceResource created on azure
// for more information of creating EmailServiceResource, please refer to the document of EmailServiceResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
string emailServiceName = "MyEmailServiceResource";
ResourceIdentifier emailServiceResourceId = EmailServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName);
EmailServiceResource emailServiceResource = client.GetEmailServiceResource(emailServiceResourceId);

// invoke the operation
await emailServiceResource.DeleteAsync(WaitUntil.Completed);

Console.WriteLine($"Succeeded");

Notitie

Het verwijderen van resources is permanent en er kunnen geen gegevens, waaronder event grid-filters, telefoonnummers of andere gegevens die aan uw resource zijn gekoppeld, worden hersteld als u de resource verwijdert.

Vereisten

E-mailcommunicatieserviceresource maken

Als u een e-mailcommunicatieserviceresource wilt maken, meldt u zich aan bij uw Azure-account met behulp van de Connect-AzAccount volgende opdracht en geeft u uw referenties op.

PS C:\> Connect-AzAccount

Zorg er eerst voor dat u de Azure Communication Services-module Az.Communication installeert met behulp van de volgende opdracht.

PS C:\> Install-Module Az.Communication

Voer de volgende opdracht uit om de resource te maken:

PS C:\> New-AzEmailService -ResourceGroupName ContosoResourceProvider1 -Name ContosoEmailServiceResource1 -DataLocation UnitedStates

Als u een specifiek abonnement wilt selecteren, kunt u ook de --subscription vlag opgeven en de abonnements-id opgeven.

PS C:\> New-AzEmailService -ResourceGroupName ContosoResourceProvider1 -Name ContosoEmailServiceResource1 -DataLocation UnitedStates -SubscriptionId SubscriptionID

U kunt uw Communication Services-resource configureren met de volgende opties:

  • De resourcegroep
  • De naam van de resource e-mailcommunicatieservices
  • De geografie waaraan de resource wordt gekoppeld

In de volgende stap kunt u tags toewijzen aan de resource. Tags kunnen worden gebruikt om uw Azure Email-resources te organiseren. Zie de documentatie voor het taggen van resources voor meer informatie over tags.

Uw E-mail Communication Services-resource beheren

Voer de volgende opdrachten uit om tags toe te voegen aan uw E-mail Communication Services-resource. U kunt ook een specifiek abonnement instellen.

PS C:\> Update-AzEmailService -Name ContosoEmailServiceResource1 -ResourceGroupName ContosoResourceProvider1 -Tag @{ExampleKey1="ExampleValue1"}

PS C:\> Update-AzEmailService -Name ContosoEmailServiceResource1 -ResourceGroupName ContosoResourceProvider1 -Tag @{ExampleKey1="ExampleValue1"} -SubscriptionId SubscriptionID

Gebruik de volgende opdracht om alle resources van uw e-mailcommunicatieservice in een bepaald abonnement weer te geven:

PS C:\> Get-AzEmailService -SubscriptionId SubscriptionID

Als u alle informatie over een bepaalde resource wilt weergeven, gebruikt u de volgende opdracht:

PS C:\> Get-AzEmailService -Name ContosoEmailServiceResource1 -ResourceGroupName ContosoResourceProvider1

Resource opschonen

Als u een e-mailcommunicatieservice wilt opschonen en verwijderen, kunt u uw e-mailcommunicatieresource verwijderen door de volgende opdracht uit te voeren:

PS C:\> Remove-AzEmailService -Name ContosoEmailServiceResource1 -ResourceGroupName ContosoResourceProvider1

Notitie

Het verwijderen van resources is permanent en er kunnen geen gegevens, waaronder event grid-filters, telefoonnummers of andere gegevens die aan uw resource zijn gekoppeld, worden hersteld als u de resource verwijdert.

Volgende stappen