Listas todos los userAssignedIdentities disponibles en el ResourceGroup especificado.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities?api-version=2023-01-31
Parámetros de identificador URI
Nombre |
En |
Requerido |
Tipo |
Description |
resourceGroupName
|
path |
True
|
string
|
Nombre del grupo de recursos al que pertenece la identidad.
|
subscriptionId
|
path |
True
|
string
|
Identificador de la suscripción a la que pertenece la identidad.
|
api-version
|
query |
True
|
string
|
Versión de la API que se va a invocar.
|
Respuestas
Nombre |
Tipo |
Description |
200 OK
|
UserAssignedIdentitiesListResult
|
Aceptar. La lista de userAssignedIdentities se recuperó y devolvió correctamente.
|
Other Status Codes
|
CloudError
|
Respuesta de error que describe el motivo del error de la operación.
|
Seguridad
azure_auth
Flujo OAuth2 de Azure Active Directory
Tipo:
oauth2
Flujo:
implicit
Dirección URL de autorización:
https://login.microsoftonline.com/common/oauth2/authorize
Ámbitos
Nombre |
Description |
user_impersonation
|
suplantación de su cuenta de usuario
|
Ejemplos
IdentityListByResourceGroup
Solicitud de ejemplo
GET https://management.azure.com/subscriptions/subid/resourceGroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities?api-version=2023-01-31
/**
* Samples for UserAssignedIdentities ListByResourceGroup.
*/
public final class Main {
/*
* x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/
* IdentityListByResourceGroup.json
*/
/**
* Sample code: IdentityListByResourceGroup.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void identityListByResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) {
azure.identities().manager().serviceClient().getUserAssignedIdentities().listByResourceGroup("rgName",
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_list_by_resource_group.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.list_by_resource_group(
resource_group_name="rgName",
)
for item in response:
print(item)
# x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityListByResourceGroup.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/IdentityListByResourceGroup.json
func ExampleUserAssignedIdentitiesClient_NewListByResourceGroupPager() {
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)
}
pager := clientFactory.NewUserAssignedIdentitiesClient().NewListByResourceGroupPager("rgName", 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.UserAssignedIdentitiesListResult = armmsi.UserAssignedIdentitiesListResult{
// Value: []*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 Lists all the userAssignedIdentities available under the specified ResourceGroup.
*
* @summary Lists all the userAssignedIdentities available under the specified ResourceGroup.
* x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityListByResourceGroup.json
*/
async function identityListByResourceGroup() {
const subscriptionId = process.env["MSI_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["MSI_RESOURCE_GROUP"] || "rgName";
const credential = new DefaultAzureCredential();
const client = new ManagedServiceIdentityClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.userAssignedIdentities.listByResourceGroup(resourceGroupName)) {
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;
using Azure.ResourceManager.ManagedServiceIdentities;
// Generated from example definition: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityListByResourceGroup.json
// this example is just showing the usage of "UserAssignedIdentities_ListByResourceGroup" 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);
// 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 = "subid";
string resourceGroupName = "rgName";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this UserAssignedIdentityResource
UserAssignedIdentityCollection collection = resourceGroupResource.GetUserAssignedIdentities();
// invoke the operation and iterate over the result
await foreach (UserAssignedIdentityResource 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
UserAssignedIdentityData 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
Respuesta de muestra
{
"value": [
{
"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"
}
],
"nextLink": "https://serviceRoot/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities?api-version=2023-01-31&$skiptoken=X'12345'"
}
Definiciones
CloudError
Respuesta de error del servicio ManagedServiceIdentity.
Nombre |
Tipo |
Description |
error
|
CloudErrorBody
|
Lista de detalles adicionales sobre el error.
|
CloudErrorBody
Respuesta de error del servicio ManagedServiceIdentity.
Nombre |
Tipo |
Description |
code
|
string
|
Identificador del error.
|
details
|
CloudErrorBody[]
|
Lista de detalles adicionales sobre el error.
|
message
|
string
|
Mensaje que describe el error, diseñado para ser adecuado para mostrarse en una interfaz de usuario.
|
target
|
string
|
Destino del error concreto. Por ejemplo, el nombre de la propiedad en error.
|
createdByType
Tipo de identidad que creó el recurso.
Nombre |
Tipo |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
Identity
Describe un recurso de identidad.
Nombre |
Tipo |
Description |
id
|
string
|
Identificador de recurso completo del recurso. Por ejemplo, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
|
location
|
string
|
Ubicación geográfica donde reside el recurso
|
name
|
string
|
Nombre del recurso.
|
properties.clientId
|
string
|
Identificador de la aplicación asociada a la identidad. Se trata de un UUID generado aleatoriamente por MSI.
|
properties.principalId
|
string
|
Identificador del objeto de entidad de servicio asociado a la identidad creada.
|
properties.tenantId
|
string
|
Identificador del inquilino al que pertenece la identidad.
|
systemData
|
systemData
|
Metadatos de Azure Resource Manager que contienen información sobre los valores de createdBy y modifiedBy.
|
tags
|
object
|
Etiquetas del recurso.
|
type
|
string
|
Tipo de recurso. Por ejemplo, "Microsoft.Compute/virtualMachines" o "Microsoft.Storage/storageAccounts"
|
systemData
Metadatos relacionados con la creación y la última modificación del recurso.
Nombre |
Tipo |
Description |
createdAt
|
string
|
Marca de tiempo de creación de recursos (UTC).
|
createdBy
|
string
|
Identidad que creó el recurso.
|
createdByType
|
createdByType
|
Tipo de identidad que creó el recurso.
|
lastModifiedAt
|
string
|
Marca de tiempo de la última modificación del recurso (UTC)
|
lastModifiedBy
|
string
|
Identidad que modificó por última vez el recurso.
|
lastModifiedByType
|
createdByType
|
Tipo de identidad que modificó por última vez el recurso.
|
UserAssignedIdentitiesListResult
Valores devueltos por la operación List.
Nombre |
Tipo |
Description |
nextLink
|
string
|
Dirección URL para obtener la siguiente página de resultados, si existe.
|
value
|
Identity[]
|
Colección de userAssignedIdentities devuelta por la operación de enumeración.
|