Operazioni sui domini (anteprima) | Informazioni di riferimento sull'API Graph

Si applica a: API Graph | Azure Active Directory

Questo argomento descrive come eseguire operazioni sui domini tramite l'API Graph di Azure Active Directory (Azure AD).

Importante

Le operazioni sui domini sono attualmente in anteprima e sono supportate solo nella versione beta dell'API Graph di Azure AD.

L'API Graph è un'API REST conforme alla specifica OData 3.0 che fornisce accesso a livello di codice agli oggetti directory in Azure Active Directory, ad esempio utenti, gruppi, contatti aziendali e applicazioni.

Importante

La funzionalità API Graph di Azure AD è anche disponibile tramite Microsoft Graph, un'API unificata che include le API di altri servizi Microsoft, come Outlook, OneDrive, OneNote, Planner e Office Graph, a cui si può accedere mediante un unico endpoint con un singolo token di accesso. Si noti che le operazioni sui domini non sono attualmente supportate in Microsoft Graph. Per questa funzionalità è necessario usare l'API Graph di Azure AD.

Esecuzione di operazioni REST sui domini

Per eseguire operazioni sui domini con l'API Graph, si inviano richieste HTTP con un metodo supportato (GET, POST, PATCH, PUT o DELETE) a un endpoint che fa riferimento alla raccolta di risorse dei domini, a un dominio specifico, a una proprietà di navigazione di un dominio oppure a una funzione o azione che può essere chiamata su un dominio.

Le richieste dell'API Graph usano l'URL di base seguente:

https://graph.windows.net/{tenant_id}/{resource_path}?{api_version}[odata_query_parameters]

Importante

Le richieste inviate all'API Graph devono presentare il formato corretto, specificare come destinazione un endpoint e una versione dell'API Graph corretti e includere nell'intestazione Authorization un token di accesso valido ottenuto da Azure AD. Per informazioni dettagliate sulla creazione di richieste e la ricezione di risposte con l'API Graph, vedere [Operations Overview].

Il percorso {resource_path} specificato sarà diverso a seconda della destinazione dell'operazione, ad esempio la raccolta di tutti i domini nel tenant, un singolo dominio o una proprietà di navigazione di un dominio specifico.

  • /domains indica che la destinazione è la raccolta di risorse dei domini. È possibile usare questo percorso della risorsa per leggere tutti i domini o un elenco filtrato di domini nel tenant per creare uno o più nuovi domini nel tenant.
  • /domains({domain_name}) indica che la destinazione è un singolo dominio nel tenant. Si specifica domain-name come nome di dominio completo del dominio di destinazione racchiuso tra virgolette singolo. È possibile usare questo percorso della risorsa per ottenere le proprietà dichiarate di un dominio, per modificarle oppure per eliminare un dominio.
  • /domains({domain_name})/{nav_property} indica che la destinazione è la proprietà di navigazione specificata di un dominio. È possibile usare questo percorso per restituire gli oggetti a cui fa riferimento la proprietà di navigazione di destinazione del dominio specificato. Nota: questo modello di definizione del percorso è disponibile solo per le operazioni di lettura.
  • /domains({domain_name})/$links/{nav_property} indica che la destinazione è la proprietà di navigazione specificata di un dominio. È possibile usare questo modello di definizione del percorso per le operazioni di lettura e di modifica di una proprietà di navigazione. Per le operazioni di lettura, gli oggetti a cui fa riferimento la proprietà vengono restituiti come uno o più collegamenti nel corpo della risposta. Per le operazioni di scrittura, gli oggetti sono specificati come uno o più collegamenti nel corpo della richiesta.

La richiesta seguente, ad esempio, restituisce un collegamento ai record di configurazione del servizio del dominio specificato:

GET https://graph.windows.net/myorganization/domains('contoso.com')/serviceConfigurationRecords?api-version=beta

Importante: le operazioni sui domini sono supportate solo nella versione beta.

Operazioni di base sui domini (anteprima)

È possibile eseguire operazioni di creazione, lettura, aggiornamento ed eliminazione (CRUD) sui domini e sulle relative proprietà dichiarate specificando come destinazione la raccolta di risorse del dominio o un dominio specifico. Gli argomenti seguenti illustrano come fare.

L'API Graph supporta le operazioni sui gruppi come indicato di seguito:

  • Creazione (POST): per domini verificati e non verificati.
  • Lettura (GET): per tutti i domini.
  • Aggiornamento (PATCH): solo per domini verificati. Non tutte le proprietà sono supportate.
  • Eliminazione (DELETE): per tutti i domini.

Ottieni domini (anteprima)

Ottiene una raccolta di domini. È possibile aggiungere parametri di query OData alla richiesta per filtrare, ordinare ed eseguire il paging della risposta. Per altre informazioni, vedere Query, opzioni di paging e filtri supportati nell'API Graph di Azure AD.

Se l'operazione riesce, restituisce una raccolta di oggetti [Domain]; in caso contrario, il corpo della risposta contiene i dettagli dell'errore. Per altre informazioni sugli errori, vedere Error Codes and Error Handling.

GET https://graph.windows.net/myorganization/domains?api-version

Parameters

ParameterTypeValueNotes
Query
api-versionstring

1.6

The version of the Graph API to target. Only '1.6' is supported. Required.

Response

Status Code:200

Content-Type: application/json

{
  "odata.metadata": "https://graph.windows.net/contoso.onmicrosoft.com/$metadata#domains",
  "value": [
    {
      "authenticationType": "Managed",
      "availabilityStatus": null,
      "adminManaged": true,
      "isDefault": true,
      "isInitial": true,
      "isRoot": true,
      "isVerified": true,
      "name": "contoso.onmicrosoft.com",
      "supportedServices": [
        "Email",
        "OfficeCommunicationsOnline"
      ]
    }
  ]
}

Response List

Status CodeDescription
200OK. Indicates success. The results are returned in the response body.
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;

namespace CSHttpClientSample
{
    static class Program
    {
	    static void Main()
        {
            MakeRequest();

            Console.WriteLine("Hit ENTER to exit...");
            Console.ReadLine();
        }

        static async void MakeRequest()
        {
            var client = new HttpClient();
            var queryString = HttpUtility.ParseQueryString(string.Empty);

            /* OAuth2 is required to access this API. For more information visit:
               https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks */



		   // Specify values for the following required parameters
			queryString["api-version"] = "1.6";
            // Specify values for path parameters (shown as {...})
            var uri = "https://graph.windows.net/myorganization/domains?" + queryString;


            var response = await client.GetAsync(uri);

            if (response.Content != null)
            {
                var responseString = await response.Content.ReadAsStringAsync();
                Console.WriteLine(responseString);
            }
        }
    }
}

@ECHO OFF

REM OAuth2 is required to access this API. For more information visit: https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks
REM Specify values for path parameters (shown as {...}), values for query parameters
curl -v -X GET "https://graph.windows.net/myorganization/domains?api-version=1.6&"^

// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class JavaSample {

  public static void main(String[] args) {
	HttpClient httpclient = HttpClients.createDefault();

	try
	{
		// OAuth2 is required to access this API. For more information visit:
		// https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

		// Specify values for path parameters (shown as {...})
		URIBuilder builder = new URIBuilder("https://graph.windows.net/myorganization/domains");
		// Specify values for the following required parameters
		builder.setParameter("api-version", "1.6");
		URI uri = builder.build();
		HttpGet request = new HttpGet(uri);
		HttpResponse response = httpclient.execute(request);
		HttpEntity entity = response.getEntity();
		if (entity != null) {
			System.out.println(EntityUtils.toString(entity));
		}
	}
	catch (Exception e)
	{
		System.out.println(e.getMessage());
	}
  }
}


<!DOCTYPE html>
<html>
<head>
<title>JSSample</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
	$(function() {
		// OAuth2 is required to access this API. For more information visit:
		// https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

		var params = {
			// Specify values for the following required parameters
			'api-version': "1.6",
		};
		
		$.ajax({
			// Specify values for path parameters (shown as {...})
			url: 'https://graph.windows.net/myorganization/domains?' + $.param(params),
			type: 'GET',
		})
		.done(function(data) {
			alert("success");
		})
		.fail(function() {
			alert("error");
		});
	});
</script>
</body>
</html>


#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
	// OAuth2 is required to access this API. For more information visit:
	// https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

	// Specify values for path parameters (shown as {...})
    NSString* path = @"https://graph.windows.net/myorganization/domains";
    NSArray* array = @[
                         @"entities=true",
                      ];
    
    NSString* string = [array componentsJoinedByString:@"&"];
    path = [path stringByAppendingFormat:@"?%@", string];
    NSLog(@"%@", path);

    NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
    [_request setHTTPMethod:@"GET"];
    
    NSURLResponse *response = nil;
    NSError *error = nil;
    NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];
    if(nil != error)
    {
        NSLog(@"Error: %@", error);
    }
    else
    {
        NSError* error = nil;
        NSMutableDictionary* json = nil;
        
        NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
        NSLog(@"%@", dataString);
        
        if(nil != _connectionData)
        {
            json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
        }
        
        if (error || !json)
        {
            NSLog(@"Could not parse loaded json with error:%@", error);
        }
        
        NSLog(@"%@", json);
        _connectionData = nil;
    }
    
    [pool drain];
    return 0;
}

<?php

// This sample uses the pecl_http package. (for more information: http://pecl.php.net/package/pecl_http)
require_once 'HTTP/Request2.php';
$headers = array(
);

$query_params = array(
	// Specify values for the following required parameters
	'api-version' => '1.6',
);

$request = new Http_Request2('https://graph.windows.net/myorganization/domains');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setHeader($headers);

// OAuth2 is required to access this API. For more information visit:
// https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

$url = $request->getUrl();
$url->setQueryVariables($query_params);

try
{
	$response = $request->send();
	
	echo $response->getBody();
}
catch (HttpException $ex)
{
	echo $ex;
}

?>


########### Python 2.7 #############
import httplib, urllib, base64

# OAuth2 is required to access this API. For more information visit: https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

headers = {
}

params = urllib.urlencode({
	# Specify values for the following required parameters
	'api-version': '1.6',
})

try:
	conn = httplib.HTTPSConnection('graph.windows.net')
	# Specify values for path parameters (shown as {...}) and request body if needed
	conn.request("GET", "/myorganization/domains?%s" % params, "", headers)
	response = conn.getresponse()
	data = response.read()
	print(data)
	conn.close()
except Exception as e:
	print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64

# OAuth2 is required to access this API. For more information visit: https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

headers = {
}

params = urllib.parse.urlencode({
	# Specify values for the following required parameters
	'api-version': '1.6',
})

try:
	conn = http.client.HTTPSConnection('graph.windows.net')
	# Specify values for path parameters (shown as {...}) and request body if needed
	conn.request("GET", "/myorganization/domains?%s" % params, "", headers)
	response = conn.getresponse()
	data = response.read()
	print(data)
	conn.close()
except Exception as e:
	print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

require 'net/http'

uri = URI('https://graph.windows.net/myorganization/domains')

uri.query = URI.encode_www_form({
	# Specify values for the following required parameters
	'api-version' => '1.6',
})

request = Net::HTTP::Get.new(uri.request_uri)

# OAuth2 is required to access this API. For more information visit: https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks



response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
    http.request(request)
end

puts response.body

Ottieni un dominio (anteprima)

Ottiene un dominio specificato. Specificare il dominio con il nome di dominio completo corrispondente.

Se l'operazione riesce, restituisce l'oggetto [Domain] per il dominio specificato; in caso contrario, il corpo della risposta contiene i dettagli dell'errore. Per altre informazioni sugli errori, vedere Error Codes and Error Handling.

GET https://graph.windows.net/myorganization/domains({domain_name})?api-version

Parameters

ParameterTypeValueNotes
URL
domain_namestring

'contoso.onmicrosoft.com'

The fully qualified domain name of the target domain. Must be enclosed in single quotes.
Query
api-versionstring

1.6

Specifies the version of the Graph API to target. Only '1.6' is supported. Required.
GET https://graph.windows.net/myorganization/domains('contoso.onmicrosoft.com')?api-version=1.6

Response

Status Code:200

Content-Type: application/json

{
  "odata.metadata": "https://graph.windows.net/myorganization/$metadata#domains/@Element",
  "authenticationType": "Managed",
  "availabilityStatus": null,
  "AdminManaged": true,
  "isDefault": true,
  "isInitial": true,
  "isRoot": true,
  "isVerified": true,
  "name": "contoso.onmicrosoft.com",
  "supportedServices": [
    "Email",
    "OfficeCommunicationsOnline"
  ]
}

Response List

Status CodeDescription
200OK. Indicates success. The domain is returned in the response body.
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;

namespace CSHttpClientSample
{
    static class Program
    {
	    static void Main()
        {
            MakeRequest();

            Console.WriteLine("Hit ENTER to exit...");
            Console.ReadLine();
        }

        static async void MakeRequest()
        {
            var client = new HttpClient();
            var queryString = HttpUtility.ParseQueryString(string.Empty);

            /* OAuth2 is required to access this API. For more information visit:
               https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks */



		   // Specify values for the following required parameters
			queryString["api-version"] = "1.6";
            // Specify values for path parameters (shown as {...})
            var uri = "https://graph.windows.net/myorganization/domains({domain_name})?" + queryString;


            var response = await client.GetAsync(uri);

            if (response.Content != null)
            {
                var responseString = await response.Content.ReadAsStringAsync();
                Console.WriteLine(responseString);
            }
        }
    }
}

@ECHO OFF

REM OAuth2 is required to access this API. For more information visit: https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks
REM Specify values for path parameters (shown as {...}), values for query parameters
curl -v -X GET "https://graph.windows.net/myorganization/domains({domain_name})?api-version=1.6&amp;"^
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class JavaSample {

  public static void main(String[] args) {
	HttpClient httpclient = HttpClients.createDefault();

	try
	{
		// OAuth2 is required to access this API. For more information visit:
		// https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

		// Specify values for path parameters (shown as {...})
		URIBuilder builder = new URIBuilder("https://graph.windows.net/myorganization/domains({domain_name})");
		// Specify values for the following required parameters
		builder.setParameter("api-version", "1.6");
		URI uri = builder.build();
		HttpGet request = new HttpGet(uri);
		HttpResponse response = httpclient.execute(request);
		HttpEntity entity = response.getEntity();
		if (entity != null) {
			System.out.println(EntityUtils.toString(entity));
		}
	}
	catch (Exception e)
	{
		System.out.println(e.getMessage());
	}
  }
}


<!DOCTYPE html>
<html>
<head>
<title>JSSample</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
	$(function() {
		// OAuth2 is required to access this API. For more information visit:
		// https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

		var params = {
			// Specify values for the following required parameters
			'api-version': "1.6",
		};
		
		$.ajax({
			// Specify values for path parameters (shown as {...})
			url: 'https://graph.windows.net/myorganization/domains({domain_name})?' + $.param(params),
			type: 'GET',
		})
		.done(function(data) {
			alert("success");
		})
		.fail(function() {
			alert("error");
		});
	});
</script>
</body>
</html>


#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
	// OAuth2 is required to access this API. For more information visit:
	// https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

	// Specify values for path parameters (shown as {...})
    NSString* path = @"https://graph.windows.net/myorganization/domains({domain_name})";
    NSArray* array = @[
                         @"entities=true",
                      ];
    
    NSString* string = [array componentsJoinedByString:@"&"];
    path = [path stringByAppendingFormat:@"?%@", string];
    NSLog(@"%@", path);

    NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
    [_request setHTTPMethod:@"GET"];
    
    NSURLResponse *response = nil;
    NSError *error = nil;
    NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];
    if(nil != error)
    {
        NSLog(@"Error: %@", error);
    }
    else
    {
        NSError* error = nil;
        NSMutableDictionary* json = nil;
        
        NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
        NSLog(@"%@", dataString);
        
        if(nil != _connectionData)
        {
            json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
        }
        
        if (error || !json)
        {
            NSLog(@"Could not parse loaded json with error:%@", error);
        }
        
        NSLog(@"%@", json);
        _connectionData = nil;
    }
    
    [pool drain];
    return 0;
}

<?php

// This sample uses the pecl_http package. (for more information: http://pecl.php.net/package/pecl_http)
require_once 'HTTP/Request2.php';
$headers = array(
);

$query_params = array(
	// Specify values for the following required parameters
	'api-version' => '1.6',
);

$request = new Http_Request2('https://graph.windows.net/myorganization/domains({domain_name})');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setHeader($headers);

// OAuth2 is required to access this API. For more information visit:
// https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

$url = $request->getUrl();
$url->setQueryVariables($query_params);

try
{
	$response = $request->send();
	
	echo $response->getBody();
}
catch (HttpException $ex)
{
	echo $ex;
}

?>


########### Python 2.7 #############
import httplib, urllib, base64

# OAuth2 is required to access this API. For more information visit: https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

headers = {
}

params = urllib.urlencode({
	# Specify values for the following required parameters
	'api-version': '1.6',
})

try:
	conn = httplib.HTTPSConnection('graph.windows.net')
	# Specify values for path parameters (shown as {...}) and request body if needed
	conn.request("GET", "/myorganization/domains({domain_name})?%s" % params, "", headers)
	response = conn.getresponse()
	data = response.read()
	print(data)
	conn.close()
except Exception as e:
	print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64

# OAuth2 is required to access this API. For more information visit: https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

headers = {
}

params = urllib.parse.urlencode({
	# Specify values for the following required parameters
	'api-version': '1.6',
})

try:
	conn = http.client.HTTPSConnection('graph.windows.net')
	# Specify values for path parameters (shown as {...}) and request body if needed
	conn.request("GET", "/myorganization/domains({domain_name})?%s" % params, "", headers)
	response = conn.getresponse()
	data = response.read()
	print(data)
	conn.close()
except Exception as e:
	print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

require 'net/http'

uri = URI('https://graph.windows.net/myorganization/domains({domain_name})')

uri.query = URI.encode_www_form({
	# Specify values for the following required parameters
	'api-version' => '1.6',
})

request = Net::HTTP::Get.new(uri.request_uri)

# OAuth2 is required to access this API. For more information visit: https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks



response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
    http.request(request)
end

puts response.body

Crea un dominio (anteprima)

Aggiunge un dominio al tenant. Il corpo della richiesta contiene la proprietà name per il nuovo dominio. Si tratta dell'unica proprietà che si può specificare ed è una proprietà obbligatoria.

La tabella seguente mostra le proprietà necessarie per la creazione di un dominio.

Parametro obbligatorio Tipo Descrizione
name stringa Nome di dominio completo del nuovo dominio, ad esempio "contoso.com".

Importante: se il dominio creato è un sottodominio di un dominio verificato esistente nel tenant, verrà creato come dominio verificato (la proprietà isVerified è true); in caso contrario, verrà creato come dominio non verificato (la proprietà isVerified è false).

Se l'operazione riesce, restituisce l'oggetto [Domain] appena creato; in caso contrario, il corpo della risposta contiene i dettagli dell'errore. Per altre informazioni sugli errori, vedere Error Codes and Error Handling.

POST https://graph.windows.net/myorganization/domains?api-version

Parameters

ParameterTypeValueNotes
Query
api-versionstring

1.6

The version of the Graph API to target. Only '1.6' is supported. Required.
Body

Content-Type: application/json

{
  "name": "contoso.com"
}

Response

Status Code:201

Content-Type: application/json

{
  "odata.metadata": "https://graph.windows.net/contoso.onmicrosoft.com/$metadata#domains/@Element",
  "authenticationType": "Managed",
  "availabilityStatus": null,
  "isAdminManaged": false,
  "isDefault": false,
  "isInitial": false,
  "isRoot": false,
  "isVerified": false,
  "name": "contoso.com",
  "supportedServices": []
}

Response List

Status CodeDescription
201Created. Indicates success. The new domain is returned in the response body.

Aggiorna un dominio (anteprima)

Aggiorna le proprietà di un dominio. Specificare qualsiasi proprietà [Domain] accessibile in scrittura nel corpo della richiesta. Vengono modificate solo le proprietà specificate.

Importante: è possibile aggiornare solo i domini verificati.

Se l'operazione riesce, non viene restituito alcun corpo della risposta; in caso contrario, il corpo della risposta contiene i dettagli dell'errore. Per altre informazioni sugli errori, vedere Error Codes and Error Handling.

PATCH https://graph.windows.net/myorganization/domains({domain_name})?api-version

Parameters

ParameterTypeValueNotes
URL
domain_namestring

'contoso.com'

The fully qualified domain name of the target domain. Must be enclosed in single quotes.
Query
api-versionstring

1.6

The version of the Graph API to target. Only '1.6' is supported. Required.
Body

Content-Type: application/json

{
  "isDefault": true
}
PATCH https://graph.windows.net/myorganization/domains('contoso.com')?api-version=1.6

Response

Status Code:204

Content-Type: application/json

Response List

Status CodeDescription
204No Content. Indicates success. No response body is returned.

Elimina un dominio (anteprima)

Elimina una dominio. Non è possibile recuperare i domini eliminati.

Se l'operazione riesce, non viene restituito alcun corpo della risposta; in caso contrario, il corpo della risposta contiene i dettagli dell'errore. Per altre informazioni sugli errori, vedere Error Codes and Error Handling.

DELETE https://graph.windows.net/myorganization/domains({domain_name})[?api-version]

Parameters

ParameterTypeValueNotes
URL
domain_namestring

'contoso.com'

The fully qualified domain name of the target domain. Must be enclosed in single quotes.
Query
api-versionstring

1.6

Specifies the version of the Graph API to target. Only '1.6' is supported. Required.
DELETE https://graph.windows.net/myorganization/domains('contoso.com')?api-version=1.6

Response

Status Code:204

Content-Type: application/json

Response List

Status CodeDescription
204No Content. Indicates success.

Operazioni sulle proprietà di navigazione dei domini (anteprima)

Le relazioni tra un dominio e altri oggetti nella directory, ad esempio i relativi record di verifica e i record di configurazione del servizio, sono esposte tramite le proprietà di navigazione. È possibile leggere queste relazioni includendo tali proprietà di navigazione nelle richieste.

Ottieni i record di verifica di un dominio (anteprima)

Ottiene i record di verifica del dominio dalla proprietà di navigazione verificationDnsRecords.

Non è possibile usare il dominio con il tenant di Azure AD fino a quando non si conferma di essere il proprietario del dominio. Per verificare la proprietà del dominio, è prima necessario recuperare un set di record di verifica del dominio e aggiungerli nel file di zona del dominio.

Se l'operazione riesce, restituisce una raccolta di oggetti [DomainDnsRecord]; in caso contrario, il corpo della risposta contiene i dettagli dell'errore. Per altre informazioni sugli errori, vedere Error Codes and Error Handling.

Nota: è possibile aggiungere il segmento "$links" all'URL per restituire i collegamenti alle entità [DomainDnsRecord].

GET https://graph.windows.net/myorganization/domains({domain_name})/verificationDnsRecords?api-version

Parameters

ParameterTypeValueNotes
URL
domain_namestring

'contoso.com'

The fully qualified domain name of the target domain. Must be enclosed in single quotes.
Query
api-versionstring

1.6

The version of the Graph API to target. Only '1.6' is supported. Required.
GET https://graph.windows.net/myorganization/domains('contoso.com')/verificationDnsRecords?api-version=1.6

Response

Status Code:200

Content-Type: application/json

{
  "odata.metadata": "https://graph.windows.net/myorganization/$metadata#domainDnsRecords",
  "value": [
    {
      "odata.type": "Microsoft.DirectoryServices.DomainDnsTxtRecord",
      "dnsRecordId": "aceff52c-06a5-447f-ac5f-256ad243cc5c",
      "isOptional": false,
      "label": "contoso.com",
      "recordType": "Txt",
      "supportedService": null,
      "ttl": 3600,
      "text": "MS=ms86120656"
    },
    {
      "odata.type": "Microsoft.DirectoryServices.DomainDnsMxRecord",
      "dnsRecordId": "5fbde38c-0865-497f-82b1-126f596bcee9",
      "isOptional": false,
      "label": "contoso.com",
      "recordType": "Mx",
      "supportedService": null,
      "ttl": 3600,
      "mailExchange": "ms86120656.msv1.invalid",
      "preference": 32767
    }
  ]
}

Response List

Status CodeDescription
200OK. Indicates success. The results are returned in the response body.

Code Samples

using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;

namespace CSHttpClientSample
{
    static class Program
    {
	    static void Main()
        {
            MakeRequest();

            Console.WriteLine("Hit ENTER to exit...");
            Console.ReadLine();
        }

        static async void MakeRequest()
        {
            var client = new HttpClient();
            var queryString = HttpUtility.ParseQueryString(string.Empty);

            /* OAuth2 is required to access this API. For more information visit:
               https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks */



		   // Specify values for the following required parameters
			queryString["api-version"] = "1.6";
            // Specify values for path parameters (shown as {...})
            var uri = "https://graph.windows.net/myorganization/domains({domain_name})/verificationDnsRecords?" + queryString;


            var response = await client.GetAsync(uri);

            if (response.Content != null)
            {
                var responseString = await response.Content.ReadAsStringAsync();
                Console.WriteLine(responseString);
            }
        }
    }
}

@ECHO OFF

REM OAuth2 is required to access this API. For more information visit: https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks
REM Specify values for path parameters (shown as {...}), values for query parameters
curl -v -X GET "https://graph.windows.net/myorganization/domains({domain_name})/verificationDnsRecords?api-version=1.6&amp;"^

// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class JavaSample {

  public static void main(String[] args) {
	HttpClient httpclient = HttpClients.createDefault();

	try
	{
		// OAuth2 is required to access this API. For more information visit:
		// https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

		// Specify values for path parameters (shown as {...})
		URIBuilder builder = new URIBuilder("https://graph.windows.net/myorganization/domains({domain_name})/verificationDnsRecords");
		// Specify values for the following required parameters
		builder.setParameter("api-version", "1.6");
		URI uri = builder.build();
		HttpGet request = new HttpGet(uri);
		HttpResponse response = httpclient.execute(request);
		HttpEntity entity = response.getEntity();
		if (entity != null) {
			System.out.println(EntityUtils.toString(entity));
		}
	}
	catch (Exception e)
	{
		System.out.println(e.getMessage());
	}
  }
}
<!DOCTYPE html>
<html>
<head>
<title>JSSample</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
	$(function() {
		// OAuth2 is required to access this API. For more information visit:
		// https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

		var params = {
			// Specify values for the following required parameters
			'api-version': "1.6",
		};
		
		$.ajax({
			// Specify values for path parameters (shown as {...})
			url: 'https://graph.windows.net/myorganization/domains({domain_name})/verificationDnsRecords?' + $.param(params),
			type: 'GET',
		})
		.done(function(data) {
			alert("success");
		})
		.fail(function() {
			alert("error");
		});
	});
</script>
</body>
</html>

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
	// OAuth2 is required to access this API. For more information visit:
	// https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

	// Specify values for path parameters (shown as {...})
    NSString* path = @"https://graph.windows.net/myorganization/domains({domain_name})/verificationDnsRecords";
    NSArray* array = @[
                         @"entities=true",
                      ];
    
    NSString* string = [array componentsJoinedByString:@"&"];
    path = [path stringByAppendingFormat:@"?%@", string];
    NSLog(@"%@", path);

    NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
    [_request setHTTPMethod:@"GET"];
    
    NSURLResponse *response = nil;
    NSError *error = nil;
    NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];
    if(nil != error)
    {
        NSLog(@"Error: %@", error);
    }
    else
    {
        NSError* error = nil;
        NSMutableDictionary* json = nil;
        
        NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
        NSLog(@"%@", dataString);
        
        if(nil != _connectionData)
        {
            json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
        }
        
        if (error || !json)
        {
            NSLog(@"Could not parse loaded json with error:%@", error);
        }
        
        NSLog(@"%@", json);
        _connectionData = nil;
    }
    
    [pool drain];
    return 0;
}

<?php

// This sample uses the pecl_http package. (for more information: http://pecl.php.net/package/pecl_http)
require_once 'HTTP/Request2.php';
$headers = array(
);

$query_params = array(
	// Specify values for the following required parameters
	'api-version' => '1.6',
);

$request = new Http_Request2('https://graph.windows.net/myorganization/domains({domain_name})/verificationDnsRecords');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setHeader($headers);

// OAuth2 is required to access this API. For more information visit:
// https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

$url = $request->getUrl();
$url->setQueryVariables($query_params);

try
{
	$response = $request->send();
	
	echo $response->getBody();
}
catch (HttpException $ex)
{
	echo $ex;
}

?>

########### Python 2.7 #############
import httplib, urllib, base64

# OAuth2 is required to access this API. For more information visit: https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

headers = {
}

params = urllib.urlencode({
	# Specify values for the following required parameters
	'api-version': '1.6',
})

try:
	conn = httplib.HTTPSConnection('graph.windows.net')
	# Specify values for path parameters (shown as {...}) and request body if needed
	conn.request("GET", "/myorganization/domains({domain_name})/verificationDnsRecords?%s" % params, "", headers)
	response = conn.getresponse()
	data = response.read()
	print(data)
	conn.close()
except Exception as e:
	print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64

# OAuth2 is required to access this API. For more information visit: https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

headers = {
}

params = urllib.parse.urlencode({
	# Specify values for the following required parameters
	'api-version': '1.6',
})

try:
	conn = http.client.HTTPSConnection('graph.windows.net')
	# Specify values for path parameters (shown as {...}) and request body if needed
	conn.request("GET", "/myorganization/domains({domain_name})/verificationDnsRecords?%s" % params, "", headers)
	response = conn.getresponse()
	data = response.read()
	print(data)
	conn.close()
except Exception as e:
	print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

require 'net/http'

uri = URI('https://graph.windows.net/myorganization/domains({domain_name})/verificationDnsRecords')

uri.query = URI.encode_www_form({
	# Specify values for the following required parameters
	'api-version' => '1.6',
})

request = Net::HTTP::Get.new(uri.request_uri)

# OAuth2 is required to access this API. For more information visit: https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks



response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
    http.request(request)
end

puts response.body

Ottieni i record di configurazione del servizio del dominio (anteprima)

Ottiene i record di configurazione del servizio del dominio dalla proprietà di navigazione serviceConfigurationRecords.

Una volta verificata la proprietà del dominio e dopo aver indicato i servizi che si intende usare con il dominio, è possibile richiedere ad Azure AD di restituire un set di record DNS che dovranno essere aggiunti al file di zona del dominio per garantire il corretto funzionamento dei servizi nel dominio.

Se l'operazione riesce, restituisce una raccolta di oggetti [DomainDnsRecord]; in caso contrario, il corpo della risposta contiene i dettagli dell'errore. Per altre informazioni sugli errori, vedere Error Codes and Error Handling.

Nota: è possibile aggiungere il segmento "$links" all'URL per restituire i collegamenti alle entità [DomainDnsRecord].

GET https://graph.windows.net/myorganization/domains({domain_name})/serviceConfigurationRecords?api-version

Parameters

ParameterTypeValueNotes
URL
domain_namestring

'contoso.com'

The fully qualified domain name of the target domain. Must be enclosed in single quotes.
Query
api-versionstring

1.6

The version of the Graph API to target. Only '1.6' is supported. Required.
GET https://graph.windows.net/myorganization/domains('contoso.com')/serviceConfigurationRecords?api-version=1.6

Response

Status Code:200

Content-Type: application/json

{
  "odata.metadata": "https://graph.windows.net/myorganization/$metadata#domainDnsRecords",
  "value": [
    {
      "odata.type": "Microsoft.DirectoryServices.DomainDnsMxRecord",
      "dnsRecordId": "2b672ab0-0bee-476f-b334-be436f2449bd",
      "isOptional": false,
      "label": "contoso.com",
      "recordType": "Mx",
      "supportedService": "Email",
      "ttl": 3600,
      "mailExchange": "contoso-com.mail.protection.outlook.com",
      "preference": 0
    },
    {
      "odata.type": "Microsoft.DirectoryServices.DomainDnsTxtRecord",
      "dnsRecordId": "62bea837-a0d7-4466-b6d9-ff6bd1db8671",
      "isOptional": false,
      "label": "contoso.com",
      "recordType": "Txt",
      "supportedServices": "Email",
      "ttl": 3600,
      "text": "v=spf1 include: spf.protection.outlook.com ~all"
    },
    {
      "odata.type": "Microsoft.DirectoryServices.DomainDnsCnameRecord",
      "dnsRecordId": "eea5ce9e-8deb-4ab7-a114-13ed6215774f",
      "isOptional": false,
      "label": "autodiscover.contoso.com",
      "recordType": "CName",
      "supportedServices": "Email",
      "ttl": 3600,
      "canonicalName": "autodiscover.outlook.com"
    }
  ]
}

Response List

Status CodeDescription
200OK. Indicates success. The results are returned in the response body.
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;

namespace CSHttpClientSample
{
    static class Program
    {
	    static void Main()
        {
            MakeRequest();

            Console.WriteLine("Hit ENTER to exit...");
            Console.ReadLine();
        }

        static async void MakeRequest()
        {
            var client = new HttpClient();
            var queryString = HttpUtility.ParseQueryString(string.Empty);

            /* OAuth2 is required to access this API. For more information visit:
               https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks */



		   // Specify values for the following required parameters
			queryString["api-version"] = "1.6";
            // Specify values for path parameters (shown as {...})
            var uri = "https://graph.windows.net/myorganization/domains({domain_name})/serviceConfigurationRecords?" + queryString;


            var response = await client.GetAsync(uri);

            if (response.Content != null)
            {
                var responseString = await response.Content.ReadAsStringAsync();
                Console.WriteLine(responseString);
            }
        }
    }
}
@ECHO OFF

REM OAuth2 is required to access this API. For more information visit: https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks
REM Specify values for path parameters (shown as {...}), values for query parameters
curl -v -X GET "https://graph.windows.net/myorganization/domains({domain_name})/serviceConfigurationRecords?api-version=1.6&amp;"^

// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class JavaSample {

  public static void main(String[] args) {
	HttpClient httpclient = HttpClients.createDefault();

	try
	{
		// OAuth2 is required to access this API. For more information visit:
		// https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

		// Specify values for path parameters (shown as {...})
		URIBuilder builder = new URIBuilder("https://graph.windows.net/myorganization/domains({domain_name})/serviceConfigurationRecords");
		// Specify values for the following required parameters
		builder.setParameter("api-version", "1.6");
		URI uri = builder.build();
		HttpGet request = new HttpGet(uri);
		HttpResponse response = httpclient.execute(request);
		HttpEntity entity = response.getEntity();
		if (entity != null) {
			System.out.println(EntityUtils.toString(entity));
		}
	}
	catch (Exception e)
	{
		System.out.println(e.getMessage());
	}
  }
}

<!DOCTYPE html>
<html>
<head>
<title>JSSample</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
	$(function() {
		// OAuth2 is required to access this API. For more information visit:
		// https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

		var params = {
			// Specify values for the following required parameters
			'api-version': "1.6",
		};
		
		$.ajax({
			// Specify values for path parameters (shown as {...})
			url: 'https://graph.windows.net/myorganization/domains({domain_name})/serviceConfigurationRecords?' + $.param(params),
			type: 'GET',
		})
		.done(function(data) {
			alert("success");
		})
		.fail(function() {
			alert("error");
		});
	});
</script>
</body>
</html>
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
	// OAuth2 is required to access this API. For more information visit:
	// https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

	// Specify values for path parameters (shown as {...})
    NSString* path = @"https://graph.windows.net/myorganization/domains({domain_name})/serviceConfigurationRecords";
    NSArray* array = @[
                         @"entities=true",
                      ];
    
    NSString* string = [array componentsJoinedByString:@"&"];
    path = [path stringByAppendingFormat:@"?%@", string];
    NSLog(@"%@", path);

    NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
    [_request setHTTPMethod:@"GET"];
    
    NSURLResponse *response = nil;
    NSError *error = nil;
    NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];
    if(nil != error)
    {
        NSLog(@"Error: %@", error);
    }
    else
    {
        NSError* error = nil;
        NSMutableDictionary* json = nil;
        
        NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
        NSLog(@"%@", dataString);
        
        if(nil != _connectionData)
        {
            json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
        }
        
        if (error || !json)
        {
            NSLog(@"Could not parse loaded json with error:%@", error);
        }
        
        NSLog(@"%@", json);
        _connectionData = nil;
    }
    
    [pool drain];
    return 0;
}

<?php

// This sample uses the pecl_http package. (for more information: http://pecl.php.net/package/pecl_http)
require_once 'HTTP/Request2.php';
$headers = array(
);

$query_params = array(
	// Specify values for the following required parameters
	'api-version' => '1.6',
);

$request = new Http_Request2('https://graph.windows.net/myorganization/domains({domain_name})/serviceConfigurationRecords');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setHeader($headers);

// OAuth2 is required to access this API. For more information visit:
// https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

$url = $request->getUrl();
$url->setQueryVariables($query_params);

try
{
	$response = $request->send();
	
	echo $response->getBody();
}
catch (HttpException $ex)
{
	echo $ex;
}

?>

########### Python 2.7 #############
import httplib, urllib, base64

# OAuth2 is required to access this API. For more information visit: https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

headers = {
}

params = urllib.urlencode({
	# Specify values for the following required parameters
	'api-version': '1.6',
})

try:
	conn = httplib.HTTPSConnection('graph.windows.net')
	# Specify values for path parameters (shown as {...}) and request body if needed
	conn.request("GET", "/myorganization/domains({domain_name})/serviceConfigurationRecords?%s" % params, "", headers)
	response = conn.getresponse()
	data = response.read()
	print(data)
	conn.close()
except Exception as e:
	print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64

# OAuth2 is required to access this API. For more information visit: https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks

headers = {
}

params = urllib.parse.urlencode({
	# Specify values for the following required parameters
	'api-version': '1.6',
})

try:
	conn = http.client.HTTPSConnection('graph.windows.net')
	# Specify values for path parameters (shown as {...}) and request body if needed
	conn.request("GET", "/myorganization/domains({domain_name})/serviceConfigurationRecords?%s" % params, "", headers)
	response = conn.getresponse()
	data = response.read()
	print(data)
	conn.close()
except Exception as e:
	print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

require 'net/http'

uri = URI('https://graph.windows.net/myorganization/domains({domain_name})/serviceConfigurationRecords')

uri.query = URI.encode_www_form({
	# Specify values for the following required parameters
	'api-version' => '1.6',
})

request = Net::HTTP::Get.new(uri.request_uri)

# OAuth2 is required to access this API. For more information visit: https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks



response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
    http.request(request)
end

puts response.body

Funzioni e azioni sui domini (anteprima)

Su un dominio è possibile chiamare le azioni seguenti.

azione verify (anteprima)

È possibile chiamare l'azione [verify] su un dominio non verificato (la proprietà isVerified è false) per verificare la proprietà del dominio.

Risorse aggiuntive