Ruft die Identität ab.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}?api-version=2023-01-31
URI-Parameter
Name |
In |
Erforderlich |
Typ |
Beschreibung |
resourceGroupName
|
path |
True
|
string
|
Der Name der Ressourcengruppe, zu der die Identität gehört.
|
resourceName
|
path |
True
|
string
|
Der Name der Identitätsressource.
|
subscriptionId
|
path |
True
|
string
|
Die ID des Abonnements, zu dem die Identität gehört.
|
api-version
|
query |
True
|
string
|
Version der aufgerufenen API.
|
Antworten
Name |
Typ |
Beschreibung |
200 OK
|
Identity
|
OK. Die angeforderte Identität.
|
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
IdentityGet
Beispielanforderung
GET https://management.azure.com/subscriptions/subid/resourceGroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/resourceName?api-version=2023-01-31
/**
* Samples for UserAssignedIdentities GetByResourceGroup.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityGet.json
*/
/**
* Sample code: IdentityGet.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void identityGet(com.azure.resourcemanager.AzureResourceManager azure) {
azure.identities().manager().serviceClient().getUserAssignedIdentities()
.getByResourceGroupWithResponse("rgName", "resourceName", 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.msi import ManagedServiceIdentityClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-msi
# USAGE
python identity_get.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 = ManagedServiceIdentityClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.user_assigned_identities.get(
resource_group_name="rgName",
resource_name="resourceName",
)
print(response)
# x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityGet.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 armmsi_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityGet.json
func ExampleUserAssignedIdentitiesClient_Get() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmsi.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewUserAssignedIdentitiesClient().Get(ctx, "rgName", "resourceName", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Identity = armmsi.Identity{
// Name: to.Ptr("identityName"),
// Type: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities"),
// ID: to.Ptr("/subscriptions/subid/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName"),
// Location: to.Ptr("eastus"),
// Tags: map[string]*string{
// "key1": to.Ptr("value1"),
// "key2": to.Ptr("value2"),
// },
// Properties: &armmsi.UserAssignedIdentityProperties{
// ClientID: to.Ptr("4024ab25-56a8-4370-aea6-6389221caf29"),
// PrincipalID: to.Ptr("25cc773c-7f05-40fc-a104-32d2300754ad"),
// TenantID: to.Ptr("b6c948ef-f6b5-4384-8354-da3a15eca969"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ManagedServiceIdentityClient } = require("@azure/arm-msi");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets the identity.
*
* @summary Gets the identity.
* x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityGet.json
*/
async function identityGet() {
const subscriptionId = process.env["MSI_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["MSI_RESOURCE_GROUP"] || "rgName";
const resourceName = "resourceName";
const credential = new DefaultAzureCredential();
const client = new ManagedServiceIdentityClient(credential, subscriptionId);
const result = await client.userAssignedIdentities.get(resourceGroupName, resourceName);
console.log(result);
}
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.ManagedServiceIdentities.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.ManagedServiceIdentities;
// Generated from example definition: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityGet.json
// this example is just showing the usage of "UserAssignedIdentities_Get" 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://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this UserAssignedIdentityResource created on azure
// for more information of creating UserAssignedIdentityResource, please refer to the document of UserAssignedIdentityResource
string subscriptionId = "subid";
string resourceGroupName = "rgName";
string resourceName = "resourceName";
ResourceIdentifier userAssignedIdentityResourceId = UserAssignedIdentityResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName);
UserAssignedIdentityResource userAssignedIdentity = client.GetUserAssignedIdentityResource(userAssignedIdentityResourceId);
// invoke the operation
UserAssignedIdentityResource result = await userAssignedIdentity.GetAsync();
// 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
UserAssignedIdentityData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
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
{
"id": "/subscriptions/subid/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName",
"location": "eastus",
"name": "identityName",
"properties": {
"clientId": "4024ab25-56a8-4370-aea6-6389221caf29",
"principalId": "25cc773c-7f05-40fc-a104-32d2300754ad",
"tenantId": "b6c948ef-f6b5-4384-8354-da3a15eca969"
},
"tags": {
"key1": "value1",
"key2": "value2"
},
"type": "Microsoft.ManagedIdentity/userAssignedIdentities"
}
Definitionen
Name |
Beschreibung |
CloudError
|
Eine Fehlerantwort des ManagedServiceIdentity-Diensts.
|
CloudErrorBody
|
Eine Fehlerantwort des ManagedServiceIdentity-Diensts.
|
createdByType
|
Der Identitätstyp, der die Ressource erstellt hat.
|
Identity
|
Beschreibt eine Identitätsressource.
|
systemData
|
Metadaten, die sich auf die Erstellung und letzte Änderung der Ressource beziehen.
|
CloudError
Eine Fehlerantwort des ManagedServiceIdentity-Diensts.
Name |
Typ |
Beschreibung |
error
|
CloudErrorBody
|
Eine Liste mit zusätzlichen Details zum Fehler.
|
CloudErrorBody
Eine Fehlerantwort des ManagedServiceIdentity-Diensts.
Name |
Typ |
Beschreibung |
code
|
string
|
Ein Bezeichner für den Fehler.
|
details
|
CloudErrorBody[]
|
Eine Liste mit zusätzlichen Details zum Fehler.
|
message
|
string
|
Eine Meldung, die den Fehler beschreibt, der für die Anzeige in einer Benutzeroberfläche geeignet sein soll.
|
target
|
string
|
Das Ziel des jeweiligen Fehlers. Beispiel: Der Name der -Eigenschaft im Fehler.
|
createdByType
Der Identitätstyp, der die Ressource erstellt hat.
Name |
Typ |
Beschreibung |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
Identity
Beschreibt eine Identitätsressource.
Name |
Typ |
Beschreibung |
id
|
string
|
Vollqualifizierte Ressourcen-ID für die Ressource. Beispiel: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceProviderNamespace}/{resourceType}/{resourceName}"
|
location
|
string
|
Der geografische Standort, an dem sich die Ressource befindet
|
name
|
string
|
Der Name der Ressource
|
properties.clientId
|
string
|
Die ID der App, die der Identität zugeordnet ist. Dies ist eine zufällig generierte UUID von MSI.
|
properties.principalId
|
string
|
Die ID des Dienstprinzipalsobjekts, das der erstellten Identität zugeordnet ist.
|
properties.tenantId
|
string
|
Die ID des Mandanten, zu dem die Identität gehört.
|
systemData
|
systemData
|
Azure Resource Manager-Metadaten mit createdBy- und modifiedBy-Informationen.
|
tags
|
object
|
Ressourcentags.
|
type
|
string
|
Der Typ der Ressource. Z. B. "Microsoft.Compute/virtualMachines" oder "Microsoft.Storage/storageAccounts"
|
systemData
Metadaten, die sich auf die Erstellung und letzte Änderung der Ressource beziehen.
Name |
Typ |
Beschreibung |
createdAt
|
string
|
Der Zeitstempel der Ressourcenerstellung (UTC).
|
createdBy
|
string
|
Die Identität, die die Ressource erstellt hat.
|
createdByType
|
createdByType
|
Der Identitätstyp, der die Ressource erstellt hat.
|
lastModifiedAt
|
string
|
Der Zeitstempel der letzten Änderung der Ressource (UTC)
|
lastModifiedBy
|
string
|
Die Identität, die die Ressource zuletzt geändert hat.
|
lastModifiedByType
|
createdByType
|
Der Identitätstyp, der die Ressource zuletzt geändert hat.
|