ID でロールの割り当てを取得します。
GET https://management.azure.com/{roleAssignmentId}?api-version=2022-04-01
省略可能なパラメーターを含む:
GET https://management.azure.com/{roleAssignmentId}?api-version=2022-04-01&tenantId={tenantId}
URI パラメーター
名前 |
/ |
必須 |
型 |
説明 |
roleAssignmentId
|
path |
True
|
string
|
スコープ、リソース名、リソースの種類など、ロールの割り当ての完全修飾 ID。 形式: /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName} 例: /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME>
|
api-version
|
query |
True
|
string
|
この操作に使用する API バージョン。
|
tenantId
|
query |
|
string
|
テナント間要求のテナント ID
|
応答
セキュリティ
azure_auth
Azure Active Directory OAuth2 フロー
型:
oauth2
フロー:
implicit
Authorization URL (承認 URL):
https://login.microsoftonline.com/common/oauth2/authorize
スコープ
名前 |
説明 |
user_impersonation
|
ユーザー アカウントの借用
|
例
Get role assignment by ID
要求のサンプル
GET https://management.azure.com/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747?api-version=2022-04-01
/**
* Samples for RoleAssignments GetById.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/
* RoleAssignments_GetById.json
*/
/**
* Sample code: Get role assignment by ID.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getRoleAssignmentByID(com.azure.resourcemanager.AzureResourceManager azure) {
azure.accessManagement().roleAssignments().manager().roleServiceClient().getRoleAssignments()
.getByIdWithResponse(
"subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747",
null, 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.authorization import AuthorizationManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-authorization
# USAGE
python role_assignments_get_by_id.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 = AuthorizationManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.role_assignments.get_by_id(
role_assignment_id="subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747",
)
print(response)
# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_GetById.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 armauthorization_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_GetById.json
func ExampleRoleAssignmentsClient_GetByID() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armauthorization.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewRoleAssignmentsClient().GetByID(ctx, "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747", &armauthorization.RoleAssignmentsClientGetByIDOptions{TenantID: 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.RoleAssignment = armauthorization.RoleAssignment{
// Name: to.Ptr("b0f43c54-e787-4862-89b1-a653fa9cf747"),
// Type: to.Ptr("Microsoft.Authorization/roleAssignments"),
// ID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747"),
// Properties: &armauthorization.RoleAssignmentProperties{
// PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"),
// PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser),
// RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"),
// Scope: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { AuthorizationManagementClient } = require("@azure/arm-authorization");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Get a role assignment by ID.
*
* @summary Get a role assignment by ID.
* x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_GetById.json
*/
async function getRoleAssignmentById() {
const roleAssignmentId =
"subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747";
const credential = new DefaultAzureCredential();
const client = new AuthorizationManagementClient(credential);
const result = await client.roleAssignments.getById(roleAssignmentId);
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
応答のサンプル
{
"properties": {
"roleDefinitionId": "/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d",
"principalId": "ce2ce14e-85d7-4629-bdbc-454d0519d987",
"principalType": "User",
"scope": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2"
},
"id": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747",
"type": "Microsoft.Authorization/roleAssignments",
"name": "b0f43c54-e787-4862-89b1-a653fa9cf747"
}
定義
ErrorAdditionalInfo
リソース管理エラーの追加情報。
名前 |
型 |
説明 |
info
|
object
|
追加情報。
|
type
|
string
|
追加情報の種類。
|
ErrorDetail
エラーの詳細。
名前 |
型 |
説明 |
additionalInfo
|
ErrorAdditionalInfo[]
|
エラーの追加情報。
|
code
|
string
|
エラー コード。
|
details
|
ErrorDetail[]
|
エラーの詳細です。
|
message
|
string
|
エラー メッセージ。
|
target
|
string
|
エラーのターゲット。
|
ErrorResponse
エラー応答
PrincipalType
割り当てられたプリンシパル ID のプリンシパルの種類。
名前 |
型 |
説明 |
Device
|
string
|
|
ForeignGroup
|
string
|
|
Group
|
string
|
|
ServicePrincipal
|
string
|
|
User
|
string
|
|
RoleAssignment
ロールの割り当て
名前 |
型 |
規定値 |
説明 |
id
|
string
|
|
ロールの割り当て ID
|
name
|
string
|
|
ロールの割り当て名。
|
properties.condition
|
string
|
|
ロールの割り当てに関する条件。 これにより、割り当て可能なリソースが制限されます。例: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'
|
properties.conditionVersion
|
string
|
|
条件のバージョン。 現在、受け入れられる値は '2.0' のみです
|
properties.createdBy
|
string
|
|
割り当てを作成したユーザーの ID
|
properties.createdOn
|
string
|
|
作成された時刻
|
properties.delegatedManagedIdentityResourceId
|
string
|
|
委任されたマネージド ID リソースの ID
|
properties.description
|
string
|
|
ロールの割り当ての説明
|
properties.principalId
|
string
|
|
プリンシパル ID。
|
properties.principalType
|
PrincipalType
|
User
|
割り当てられたプリンシパル ID のプリンシパルの種類。
|
properties.roleDefinitionId
|
string
|
|
ロール定義 ID
|
properties.scope
|
string
|
|
ロールの割り当てスコープ。
|
properties.updatedBy
|
string
|
|
割り当てを更新したユーザーの ID
|
properties.updatedOn
|
string
|
|
更新された時刻
|
type
|
string
|
|
ロールの割り当ての種類。
|