Ruft die Mandanten für Ihr Konto ab.
GET https://management.azure.com/tenants?api-version=2022-12-01
URI-Parameter
Name |
In |
Erforderlich |
Typ |
Beschreibung |
api-version
|
query |
True
|
string
|
Hierbei handelt es sich um die für diesen Vorgang zu verwendende API-Version.
|
Antworten
Name |
Typ |
Beschreibung |
200 OK
|
TenantListResult
|
OK: Gibt ein Array von Mandanten zurück.
|
Other Status Codes
|
CloudError
|
Fehlerantwort mit Beschreibung des Grunds für den Fehler.
|
Sicherheit
azure_auth
Azure Active Directory-OAuth2-Flow
Typ:
oauth2
Ablauf:
implicit
Autorisierungs-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiche
Name |
Beschreibung |
user_impersonation
|
Identitätswechsel Ihres Benutzerkontos
|
Beispiele
GetAllTenants
Beispielanforderung
GET https://management.azure.com/tenants?api-version=2022-12-01
/**
* Samples for Tenants List.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/resources/resource-manager/Microsoft.Resources/stable/2022-12-01/examples/GetTenants.json
*/
/**
* Sample code: GetAllTenants.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getAllTenants(com.azure.resourcemanager.AzureResourceManager azure) {
azure.genericResources().manager().subscriptionClient().getTenants().list(com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.resource import SubscriptionClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-resource
# USAGE
python get_tenants.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SubscriptionClient(
credential=DefaultAzureCredential(),
)
response = client.tenants.list()
for item in response:
print(item)
# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-12-01/examples/GetTenants.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsubscriptions_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4f4073bdb028bc84bc3e6405c1cbaf8e89b83caf/specification/resources/resource-manager/Microsoft.Resources/stable/2022-12-01/examples/GetTenants.json
func ExampleTenantsClient_NewListPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsubscriptions.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewTenantsClient().NewListPager(nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.TenantListResult = armsubscriptions.TenantListResult{
// Value: []*armsubscriptions.TenantIDDescription{
// {
// CountryCode: to.Ptr("US"),
// DefaultDomain: to.Ptr("aad50.ccsctp.net"),
// DisplayName: to.Ptr("Test_Test_aad50"),
// Domains: []*string{
// to.Ptr("aad50.ccsctp.net")},
// ID: to.Ptr("/tenants/a70a1586-9c4a-4373-b907-1d310660dbd1"),
// TenantCategory: to.Ptr(armsubscriptions.TenantCategoryManagedBy),
// TenantID: to.Ptr("a70a1586-9c4a-4373-b907-1d310660dbd1"),
// TenantType: to.Ptr("AAD"),
// },
// {
// CountryCode: to.Ptr("US"),
// DefaultDomain: to.Ptr("auxteststagemanual.ccsctp.net"),
// DisplayName: to.Ptr("Contoso Corp."),
// Domains: []*string{
// to.Ptr("auxteststagemanual.ccsctp.net")},
// ID: to.Ptr("/tenants/83abe5cd-bcc3-441a-bd86-e6a75360cecc"),
// TenantCategory: to.Ptr(armsubscriptions.TenantCategoryHome),
// TenantID: to.Ptr("83abe5cd-bcc3-441a-bd86-e6a75360cecc"),
// TenantType: to.Ptr("AAD"),
// },
// {
// CountryCode: to.Ptr("US"),
// DefaultDomain: to.Ptr("rdvmohoro.ccsctp.net"),
// DisplayName: to.Ptr("TEST_TEST_RDV"),
// Domains: []*string{
// to.Ptr("rdvmohoro.ccsctp.net"),
// to.Ptr("rdvmohoro.mail.ccsctp.net"),
// to.Ptr("rdvmohoro.com")},
// ID: to.Ptr("/tenants/daea2e9b-847b-4c93-850d-2aa6f2d7af33"),
// TenantBrandingLogoURL: to.Ptr("logo1.logo.rdvmohoro.com"),
// TenantCategory: to.Ptr(armsubscriptions.TenantCategoryProjectedBy),
// TenantID: to.Ptr("daea2e9b-847b-4c93-850d-2aa6f2d7af33"),
// TenantType: to.Ptr("AAD"),
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SubscriptionClient } = require("@azure/arm-resources-subscriptions");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets the tenants for your account.
*
* @summary Gets the tenants for your account.
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-12-01/examples/GetTenants.json
*/
async function getAllTenants() {
const credential = new DefaultAzureCredential();
const client = new SubscriptionClient(credential);
const resArray = new Array();
for await (let item of client.tenants.list()) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/resources/resource-manager/Microsoft.Resources/stable/2022-12-01/examples/GetTenants.json
// this example is just showing the usage of "Tenants_List" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
TenantCollection collection = client.GetTenants();
// invoke the operation and iterate over the result
await foreach (TenantResource 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
TenantData resourceData = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
{
"value": [
{
"id": "/tenants/a70a1586-9c4a-4373-b907-1d310660dbd1",
"tenantId": "a70a1586-9c4a-4373-b907-1d310660dbd1",
"countryCode": "US",
"displayName": "Test_Test_aad50",
"domains": [
"aad50.ccsctp.net"
],
"tenantCategory": "ManagedBy",
"defaultDomain": "aad50.ccsctp.net",
"tenantType": "AAD"
},
{
"id": "/tenants/83abe5cd-bcc3-441a-bd86-e6a75360cecc",
"tenantId": "83abe5cd-bcc3-441a-bd86-e6a75360cecc",
"countryCode": "US",
"displayName": "Contoso Corp.",
"domains": [
"auxteststagemanual.ccsctp.net"
],
"tenantCategory": "Home",
"defaultDomain": "auxteststagemanual.ccsctp.net",
"tenantType": "AAD"
},
{
"id": "/tenants/daea2e9b-847b-4c93-850d-2aa6f2d7af33",
"tenantId": "daea2e9b-847b-4c93-850d-2aa6f2d7af33",
"countryCode": "US",
"displayName": "TEST_TEST_RDV",
"domains": [
"rdvmohoro.ccsctp.net",
"rdvmohoro.mail.ccsctp.net",
"rdvmohoro.com"
],
"tenantCategory": "ProjectedBy",
"defaultDomain": "rdvmohoro.ccsctp.net",
"tenantType": "AAD",
"tenantBrandingLogoUrl": "logo1.logo.rdvmohoro.com"
}
],
"nextLink": "..."
}
Definitionen
CloudError
Eine Fehlerantwort für eine Ressourcenverwaltungsanforderung.
Name |
Typ |
Beschreibung |
error
|
ErrorResponse
|
Fehlerantwort
Allgemeine Fehlerantwort für alle Azure Resource Manager-APIs, zur Rückgabe von Fehlerdetails für fehlgeschlagene Vorgänge. (Dies folgt auch dem OData-Fehlerantwortformat.)
|
ErrorAdditionalInfo
Zusätzliche Informationen zum Ressourcenverwaltungsfehler.
Name |
Typ |
Beschreibung |
info
|
object
|
Zusätzliche Informationen.
|
type
|
string
|
Typ der zusätzlichen Informationen.
|
ErrorDetail
Die Fehlerdetails.
Name |
Typ |
Beschreibung |
additionalInfo
|
ErrorAdditionalInfo[]
|
Die zusätzlichen Fehlerinformationen.
|
code
|
string
|
Der Fehlercode.
|
details
|
ErrorDetail[]
|
Die Fehlerdetails.
|
message
|
string
|
Die Fehlermeldung.
|
target
|
string
|
Das Fehlerziel.
|
ErrorResponse
Fehlerantwort
Name |
Typ |
Beschreibung |
error
|
ErrorDetail
|
Das Fehlerobjekt.
|
TenantCategory
Kategorie des Mandanten.
Name |
Typ |
Beschreibung |
Home
|
string
|
|
ManagedBy
|
string
|
|
ProjectedBy
|
string
|
|
TenantIdDescription
Informationen zur Mandanten-ID.
Name |
Typ |
Beschreibung |
country
|
string
|
Name des Landes/der Region der Adresse für den Mandanten.
|
countryCode
|
string
|
Abkürzung für Land/Region für den Mandanten.
|
defaultDomain
|
string
|
Die Standarddomäne für den Mandanten.
|
displayName
|
string
|
Der Anzeigename des Mandanten.
|
domains
|
string[]
|
Die Liste der Domänen für den Mandanten.
|
id
|
string
|
Die vollqualifizierte ID des Mandanten. Beispiel: /tenants/8d65815f-a5b6-402f-9298-045155da7d74
|
tenantBrandingLogoUrl
|
string
|
Die Branding-Logo-URL des Mandanten. Nur für die Mandantenkategorie "Home" verfügbar.
|
tenantCategory
|
TenantCategory
|
Kategorie des Mandanten.
|
tenantId
|
string
|
Die Mandanten-ID. Beispiel: 8d65815f-a5b6-402f-9298-045155da7d74
|
tenantType
|
string
|
Der Mandantentyp. Nur für die Mandantenkategorie "Home" verfügbar.
|
TenantListResult
Informationen zu Mandanten-IDs.
Name |
Typ |
Beschreibung |
nextLink
|
string
|
Die URL, die zum Abrufen des nächsten Resultsets verwendet werden soll.
|
value
|
TenantIdDescription[]
|
Ein Array von Mandanten.
|