azure-powershell
azure-powershell copied to clipboard
Update-AzADServicePrincipal failed with "Encountered an internal server error."
Description
I ran the following script, then got the "Encountered an internal server error." message. Is there something wrong with my approach?
$DebugPreference = 'Continue'
# Create a new Azure AD application.
$appName = 'testapp16'
$params = @{
DisplayName = $appName
SignInAudience = 'AzureADMyOrg'
IsFallbackPublicClient = $true
RequiredResourceAccess = @{
ResourceAppId = '00000003-0000-0000-c000-000000000000' # Application ID of GraphAggregatorService (Microsoft Graph)
ResourceAccess = @(
@{
Type = 'Scope'
Id = 'e1fe6dd8-ba31-4d61-89e7-88639da4683d' # Delegated, User.Read
}
)
}
}
$app = New-AzADApplication @params
# Create a corresponding service principal.
$sp = New-AzADServicePrincipal -ApplicationId $app.AppId
$userUpn = '[email protected]' # User's user principal name
$user = Get-AzADUser -UserPrincipalName $userUpn
# Assign the application to the user.
$params = @{
ObjectId = $sp.Id
AppRoleAssignedTo = @{
ResourceId = $sp.Id
PrincipalId = $user.Id
AppRoleId = '00000000-0000-0000-0000-000000000000' # Default Access
}
}
Update-AzADServicePrincipal @params
Update-AzADServicePrincipal_UpdateExpanded: C:\Program Files\PowerShell\Modules\Az.Resources\6.7.0\MSGraph.Autorest\custom\Update-AzADServicePrincipal.ps1:631
Line |
631 | $sp=Az.MSGraph.internal\Update-AzADServicePrincipal @PSBoundParam …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Encountered an internal server error.
Script or Debug output
PS C:\> $DebugPreference = 'Continue'
PS C:\> # Create a new Azure AD application.
PS C:\> $appName = 'testapp16'
PS C:\> $params = @{
>> DisplayName = $appName
>> SignInAudience = 'AzureADMyOrg'
>> IsFallbackPublicClient = $true
>> RequiredResourceAccess = @{
>> ResourceAppId = '00000003-0000-0000-c000-000000000000' # Application ID of GraphAggregatorService (Microsoft Graph)
>> ResourceAccess = @(
>> @{
>> Type = 'Scope'
>> Id = 'e1fe6dd8-ba31-4d61-89e7-88639da4683d' # Delegated, User.Read
>> }
>> )
>> }
>> }
PS C:\> $app = New-AzADApplication @params
DEBUG: Initializing ConditionalAssemblyContext. PSEdition is [Core]. PSVersion is [7.3.5].
DEBUG: Initializing ConditionalAssemblyProvider. AssemblyRootPath is [C:\Program Files\PowerShell\Modules\Az.Accounts\2.12.3\StartupScripts\..\lib].
DEBUG: Registering Az shared AssemblyLoadContext.
DEBUG: AssemblyLoadContext registered.
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: /applications
DEBUG: RequestCreated: /v1.0/applications
DEBUG: HeaderParametersAdded:
DEBUG: BodyContentSet:
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
POST
Absolute Uri:
https://graph.microsoft.com/v1.0/applications
Headers:
x-ms-unique-id : 1
x-ms-client-request-id : 75016513-be77-4dd7-8a7e-8dbbe66fdbc7
CommandName : Az.MSGraph.internal\New-AzADApplication
FullCommandName : New-AzADApplication_CreateExpanded
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v0.0.0,PSVersion/v7.3.5,Az.MSGraph/6.7.0
Body:
{
"displayName": "testapp16",
"isFallbackPublicClient": true,
"requiredResourceAccess": [
{
"resourceAccess": [
{
"id": "e1fe6dd8-ba31-4d61-89e7-88639da4683d",
"type": "Scope"
}
],
"resourceAppId": "00000003-0000-0000-c000-000000000000"
}
],
"signInAudience": "AzureADMyOrg"
}
DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
Created
Headers:
Cache-Control : no-cache
Transfer-Encoding : chunked
Location : https://graph.microsoft.com/v2/yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy/directoryObjects/zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz/Microsoft.DirectoryServices.Application
Strict-Transport-Security : max-age=31536000
request-id : 4c4cbb69-d76d-4ca2-b709-a05ad7ee4606
client-request-id : 4c4cbb69-d76d-4ca2-b709-a05ad7ee4606
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Japan East","Slice":"E","Ring":"5","ScaleUnit":"000","RoleInstance":"TY1PEPF00006051"}}
x-ms-resource-unit : 1
OData-Version : 4.0
Date : Thu, 06 Jul 2023 05:09:52 GMT
Body:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#applications/$entity",
"id": "zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz",
"deletedDateTime": null,
"appId": "wwwwwwww-wwww-wwww-wwww-wwwwwwwwwwww",
"applicationTemplateId": null,
"disabledByMicrosoftStatus": null,
"createdDateTime": "2023-07-06T05:09:52.8607478Z",
"displayName": "testapp16",
"description": null,
"groupMembershipClaims": null,
"identifierUris": [],
"isDeviceOnlyAuthSupported": null,
"isFallbackPublicClient": true,
"notes": null,
"publisherDomain": "XXXXXXXX.onmicrosoft.com",
"serviceManagementReference": null,
"signInAudience": "AzureADMyOrg",
"tags": [],
"tokenEncryptionKeyId": null,
"samlMetadataUrl": null,
"defaultRedirectUri": null,
"certification": null,
"optionalClaims": null,
"servicePrincipalLockConfiguration": null,
"requestSignatureVerification": null,
"addIns": [],
"api": {
"acceptMappedClaims": null,
"knownClientApplications": [],
"requestedAccessTokenVersion": null,
"oauth2PermissionScopes": [],
"preAuthorizedApplications": []
},
"appRoles": [],
"info": {
"logoUrl": null,
"marketingUrl": null,
"privacyStatementUrl": null,
"supportUrl": null,
"termsOfServiceUrl": null
},
"keyCredentials": [],
"parentalControlSettings": {
"countriesBlockedForMinors": [],
"legalAgeGroupRule": "Allow"
},
"passwordCredentials": [],
"publicClient": {
"redirectUris": []
},
"requiredResourceAccess": [
{
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"resourceAccess": [
{
"id": "e1fe6dd8-ba31-4d61-89e7-88639da4683d",
"type": "Scope"
}
]
}
],
"verifiedPublisher": {
"displayName": null,
"verifiedPublisherId": null,
"addedDateTime": null
},
"web": {
"homePageUrl": null,
"logoutUrl": null,
"redirectUris": [],
"implicitGrantSettings": {
"enableAccessTokenIssuance": false,
"enableIdTokenIssuance": false
},
"redirectUriSettings": []
},
"spa": {
"redirectUris": []
}
}
DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: AzureQoSEvent: Module: Az.Resources:6.7.0; CommandName: New-AzADApplication; PSVersion: 7.3.5; IsSuccess: True; Duration: 00:00:01.0545761
PS C:\> # Create a corresponding service principal.
PS C:\> $sp = New-AzADServicePrincipal -ApplicationId $app.AppId
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: /servicePrincipals
DEBUG: RequestCreated: /v1.0/servicePrincipals
DEBUG: HeaderParametersAdded:
DEBUG: BodyContentSet:
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
POST
Absolute Uri:
https://graph.microsoft.com/v1.0/servicePrincipals
Headers:
x-ms-unique-id : 2
x-ms-client-request-id : c5b1eb5c-796c-4bcc-a7a3-293254fa3bda
CommandName : Az.MSGraph.internal\New-AzADServicePrincipal
FullCommandName : New-AzADServicePrincipal_CreateExpanded
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v0.0.0,PSVersion/v7.3.5,Az.MSGraph/6.7.0
Body:
{
"appId": "wwwwwwww-wwww-wwww-wwww-wwwwwwwwwwww"
}
DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
Created
Headers:
Cache-Control : no-cache
Transfer-Encoding : chunked
Location : https://graph.microsoft.com/v2/yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy/directoryObjects/vvvvvvvv-vvvv-vvvv-vvvv-vvvvvvvvvvvv/Microsoft.DirectoryServices.ServicePrincipal
Strict-Transport-Security : max-age=31536000
request-id : 5ddff6a8-b691-43da-bb32-15e494909eb1
client-request-id : 5ddff6a8-b691-43da-bb32-15e494909eb1
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Japan East","Slice":"E","Ring":"5","ScaleUnit":"000","RoleInstance":"TY1PEPF00006051"}}
x-ms-resource-unit : 1
OData-Version : 4.0
Date : Thu, 06 Jul 2023 05:10:53 GMT
Body:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#servicePrincipals/$entity",
"id": "vvvvvvvv-vvvv-vvvv-vvvv-vvvvvvvvvvvv",
"deletedDateTime": null,
"accountEnabled": true,
"alternativeNames": [],
"appDisplayName": "testapp16",
"appDescription": null,
"appId": "wwwwwwww-wwww-wwww-wwww-wwwwwwwwwwww",
"applicationTemplateId": null,
"appOwnerOrganizationId": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy",
"appRoleAssignmentRequired": false,
"createdDateTime": null,
"description": null,
"disabledByMicrosoftStatus": null,
"displayName": "testapp16",
"homepage": null,
"loginUrl": null,
"logoutUrl": null,
"notes": null,
"notificationEmailAddresses": [],
"preferredSingleSignOnMode": null,
"preferredTokenSigningKeyThumbprint": null,
"replyUrls": [],
"servicePrincipalNames": [
"wwwwwwww-wwww-wwww-wwww-wwwwwwwwwwww"
],
"servicePrincipalType": "Application",
"signInAudience": "AzureADMyOrg",
"tags": [],
"tokenEncryptionKeyId": null,
"samlSingleSignOnSettings": null,
"addIns": [],
"appRoles": [],
"info": {
"logoUrl": null,
"marketingUrl": null,
"privacyStatementUrl": null,
"supportUrl": null,
"termsOfServiceUrl": null
},
"keyCredentials": [],
"oauth2PermissionScopes": [],
"passwordCredentials": [],
"resourceSpecificApplicationPermissions": [],
"verifiedPublisher": {
"displayName": null,
"verifiedPublisherId": null,
"addedDateTime": null
}
}
DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: AzureQoSEvent: Module: Az.Resources:6.7.0; CommandName: New-AzADServicePrincipal; PSVersion: 7.3.5; IsSuccess: True; Duration: 00:00:00.4178110
PS C:\> $userUpn = '[email protected]' # User's user principal name
PS C:\> $user = Get-AzADUser -UserPrincipalName $userUpn
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: Client side pagination is enabled for this cmdlet
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: /users?$filter=userPrincipalName%20eq%20%27user1%40XXXXXXXX.onmicrosoft.com%27
DEBUG: RequestCreated: /v1.0/users?$filter=userPrincipalName%20eq%20%27user1%40XXXXXXXX.onmicrosoft.com%27
DEBUG: HeaderParametersAdded:
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://graph.microsoft.com/v1.0/users?$filter=userPrincipalName eq %27user1%40XXXXXXXX.onmicrosoft.com%27
Headers:
x-ms-unique-id : 3
x-ms-client-request-id : 9f4f07b3-4512-4832-8999-0d99cff2032d
CommandName : Az.MSGraph.internal\Get-AzADUser
FullCommandName : Get-AzADUser_List
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v0.0.0,PSVersion/v7.3.5,Az.MSGraph/6.7.0
Body:
DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Cache-Control : no-cache
Transfer-Encoding : chunked
Strict-Transport-Security : max-age=31536000
request-id : 920f9bb5-972c-40c9-9696-3fd9701a4c6d
client-request-id : 920f9bb5-972c-40c9-9696-3fd9701a4c6d
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Japan East","Slice":"E","Ring":"5","ScaleUnit":"000","RoleInstance":"TY1PEPF00006051"}}
x-ms-resource-unit : 2
OData-Version : 4.0
Date : Thu, 06 Jul 2023 05:11:03 GMT
Body:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
"value": [
{
"businessPhones": [],
"displayName": "user1",
"givenName": null,
"jobTitle": null,
"mail": null,
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": null,
"surname": null,
"userPrincipalName": "[email protected]",
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
]
}
DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: AzureQoSEvent: Module: Az.Resources:6.7.0; CommandName: Get-AzADUser; PSVersion: 7.3.5; IsSuccess: True; Duration: 00:00:00.2825842
PS C:\> # Assign the application to the user.
PS C:\> $params = @{
>> ObjectId = $sp.Id
>> AppRoleAssignedTo = @{
>> ResourceId = $sp.Id
>> PrincipalId = $user.Id
>> AppRoleId = '00000000-0000-0000-0000-000000000000' # Default Access
>> }
>> }
PS C:\> Update-AzADServicePrincipal @params
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: /servicePrincipals/vvvvvvvv-vvvv-vvvv-vvvv-vvvvvvvvvvvv
DEBUG: RequestCreated: /v1.0/servicePrincipals/vvvvvvvv-vvvv-vvvv-vvvv-vvvvvvvvvvvv
DEBUG: HeaderParametersAdded:
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://graph.microsoft.com/v1.0/servicePrincipals/vvvvvvvv-vvvv-vvvv-vvvv-vvvvvvvvvvvv
Headers:
x-ms-unique-id : 4
x-ms-client-request-id : 99163029-63f4-4766-b50e-d8d72c177908
CommandName : Az.MSGraph.internal\Get-AzADServicePrincipal
FullCommandName : Get-AzADServicePrincipal_Get
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v0.0.0,PSVersion/v7.3.5,Az.MSGraph/6.7.0
Body:
DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Cache-Control : no-cache
Transfer-Encoding : chunked
Strict-Transport-Security : max-age=31536000
request-id : 477424ce-1fe5-496d-8158-9791866b4aef
client-request-id : 477424ce-1fe5-496d-8158-9791866b4aef
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Japan East","Slice":"E","Ring":"5","ScaleUnit":"000","RoleInstance":"TY1PEPF00006051"}}
x-ms-resource-unit : 1
OData-Version : 4.0
Date : Thu, 06 Jul 2023 05:11:12 GMT
Body:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#servicePrincipals/$entity",
"id": "vvvvvvvv-vvvv-vvvv-vvvv-vvvvvvvvvvvv",
"deletedDateTime": null,
"accountEnabled": true,
"alternativeNames": [],
"appDisplayName": "testapp16",
"appDescription": null,
"appId": "wwwwwwww-wwww-wwww-wwww-wwwwwwwwwwww",
"applicationTemplateId": null,
"appOwnerOrganizationId": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy",
"appRoleAssignmentRequired": false,
"createdDateTime": "2023-07-06T05:10:54Z",
"description": null,
"disabledByMicrosoftStatus": null,
"displayName": "testapp16",
"homepage": null,
"loginUrl": null,
"logoutUrl": null,
"notes": null,
"notificationEmailAddresses": [],
"preferredSingleSignOnMode": null,
"preferredTokenSigningKeyThumbprint": null,
"replyUrls": [],
"servicePrincipalNames": [
"wwwwwwww-wwww-wwww-wwww-wwwwwwwwwwww"
],
"servicePrincipalType": "Application",
"signInAudience": "AzureADMyOrg",
"tags": [],
"tokenEncryptionKeyId": null,
"samlSingleSignOnSettings": null,
"addIns": [],
"appRoles": [],
"info": {
"logoUrl": null,
"marketingUrl": null,
"privacyStatementUrl": null,
"supportUrl": null,
"termsOfServiceUrl": null
},
"keyCredentials": [],
"oauth2PermissionScopes": [],
"passwordCredentials": [],
"resourceSpecificApplicationPermissions": [],
"verifiedPublisher": {
"displayName": null,
"verifiedPublisherId": null,
"addedDateTime": null
}
}
DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: Client side pagination is enabled for this cmdlet
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: /applications?$filter=appId%20eq%20%27wwwwwwww-wwww-wwww-wwww-wwwwwwwwwwww%27
DEBUG: RequestCreated: /v1.0/applications?$filter=appId%20eq%20%27wwwwwwww-wwww-wwww-wwww-wwwwwwwwwwww%27
DEBUG: HeaderParametersAdded:
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://graph.microsoft.com/v1.0/applications?$filter=appId eq %27wwwwwwww-wwww-wwww-wwww-wwwwwwwwwwww%27
Headers:
x-ms-unique-id : 5
x-ms-client-request-id : 51843e89-5c65-4386-ae47-2af30c63ee9a
CommandName : Az.MSGraph.internal\Get-AzADApplication
FullCommandName : Get-AzADApplication_List
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v0.0.0,PSVersion/v7.3.5,Az.MSGraph/6.7.0
Body:
DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Cache-Control : no-cache
Transfer-Encoding : chunked
Strict-Transport-Security : max-age=31536000
request-id : a45a1154-633c-455b-88ea-424ae5234ece
client-request-id : a45a1154-633c-455b-88ea-424ae5234ece
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Japan East","Slice":"E","Ring":"5","ScaleUnit":"000","RoleInstance":"TY1PEPF00006051"}}
x-ms-resource-unit : 2
OData-Version : 4.0
Date : Thu, 06 Jul 2023 05:11:12 GMT
Body:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#applications",
"value": [
{
"id": "zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz",
"deletedDateTime": null,
"appId": "wwwwwwww-wwww-wwww-wwww-wwwwwwwwwwww",
"applicationTemplateId": null,
"disabledByMicrosoftStatus": null,
"createdDateTime": "2023-07-06T05:09:52Z",
"displayName": "testapp16",
"description": null,
"groupMembershipClaims": null,
"identifierUris": [],
"isDeviceOnlyAuthSupported": null,
"isFallbackPublicClient": true,
"notes": null,
"publisherDomain": "XXXXXXXX.onmicrosoft.com",
"serviceManagementReference": null,
"signInAudience": "AzureADMyOrg",
"tags": [],
"tokenEncryptionKeyId": null,
"samlMetadataUrl": null,
"defaultRedirectUri": null,
"certification": null,
"optionalClaims": null,
"servicePrincipalLockConfiguration": null,
"requestSignatureVerification": null,
"addIns": [],
"api": {
"acceptMappedClaims": null,
"knownClientApplications": [],
"requestedAccessTokenVersion": null,
"oauth2PermissionScopes": [],
"preAuthorizedApplications": []
},
"appRoles": [],
"info": {
"logoUrl": null,
"marketingUrl": null,
"privacyStatementUrl": null,
"supportUrl": null,
"termsOfServiceUrl": null
},
"keyCredentials": [],
"parentalControlSettings": {
"countriesBlockedForMinors": [],
"legalAgeGroupRule": "Allow"
},
"passwordCredentials": [],
"publicClient": {
"redirectUris": []
},
"requiredResourceAccess": [
{
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"resourceAccess": [
{
"id": "e1fe6dd8-ba31-4d61-89e7-88639da4683d",
"type": "Scope"
}
]
}
],
"verifiedPublisher": {
"displayName": null,
"verifiedPublisherId": null,
"addedDateTime": null
},
"web": {
"homePageUrl": null,
"logoutUrl": null,
"redirectUris": [],
"implicitGrantSettings": {
"enableAccessTokenIssuance": false,
"enableIdTokenIssuance": false
},
"redirectUriSettings": []
},
"spa": {
"redirectUris": []
}
}
]
}
DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: /applications/zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz
DEBUG: RequestCreated: /v1.0/applications/zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz
DEBUG: HeaderParametersAdded:
DEBUG: BodyContentSet:
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
PATCH
Absolute Uri:
https://graph.microsoft.com/v1.0/applications/zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz
Headers:
x-ms-unique-id : 6
x-ms-client-request-id : ef09a655-149a-48e7-9cba-448162c7ae0b
CommandName : Az.MSGraph.internal\Update-AzADApplication
FullCommandName : Update-AzADApplication_UpdateExpanded
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v0.0.0,PSVersion/v7.3.5,Az.MSGraph/6.7.0
Body:
{}
DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
NoContent
Headers:
Cache-Control : no-cache
Strict-Transport-Security : max-age=31536000
request-id : 14c1716b-c4ee-40b4-9677-850e5de72e5f
client-request-id : 14c1716b-c4ee-40b4-9677-850e5de72e5f
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Japan East","Slice":"E","Ring":"5","ScaleUnit":"000","RoleInstance":"TY1PEPF00006051"}}
x-ms-resource-unit : 1
Date : Thu, 06 Jul 2023 05:11:13 GMT
Body:
DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: /servicePrincipals/vvvvvvvv-vvvv-vvvv-vvvv-vvvvvvvvvvvv
DEBUG: RequestCreated: /v1.0/servicePrincipals/vvvvvvvv-vvvv-vvvv-vvvv-vvvvvvvvvvvv
DEBUG: HeaderParametersAdded:
DEBUG: BodyContentSet:
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
PATCH
Absolute Uri:
https://graph.microsoft.com/v1.0/servicePrincipals/vvvvvvvv-vvvv-vvvv-vvvv-vvvvvvvvvvvv
Headers:
x-ms-unique-id : 7
x-ms-client-request-id : 35bfd8c4-5d1f-4e85-9433-3e73d90b7517
CommandName : Az.MSGraph.internal\Update-AzADServicePrincipal
FullCommandName : Update-AzADServicePrincipal_UpdateExpanded
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v0.0.0,PSVersion/v7.3.5,Az.MSGraph/6.7.0
Body:
{
"appRoleAssignedTo": [
{
"appRoleId": "00000000-0000-0000-0000-000000000000",
"principalId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceId": "vvvvvvvv-vvvv-vvvv-vvvv-vvvvvvvvvvvv"
}
]
}
DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
InternalServerError
Headers:
Cache-Control : no-cache
Transfer-Encoding : chunked
Strict-Transport-Security : max-age=31536000
request-id : 6a8c060c-7e64-46a8-87a7-cdeab436babd
client-request-id : 6a8c060c-7e64-46a8-87a7-cdeab436babd
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Japan East","Slice":"E","Ring":"5","ScaleUnit":"000","RoleInstance":"TY1PEPF00006051"}}
x-ms-resource-unit : 1
Date : Thu, 06 Jul 2023 05:11:15 GMT
Body:
{
"error": {
"code": "Service_InternalServerError",
"message": "Encountered an internal server error.",
"innerError": {
"date": "2023-07-06T05:11:15",
"request-id": "6a8c060c-7e64-46a8-87a7-cdeab436babd",
"client-request-id": "6a8c060c-7e64-46a8-87a7-cdeab436babd"
}
}
}
DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
Update-AzADServicePrincipal_UpdateExpanded: C:\Program Files\PowerShell\Modules\Az.Resources\6.7.0\MSGraph.Autorest\custom\Update-AzADServicePrincipal.ps1:631
Line |
631 | $sp=Az.MSGraph.internal\Update-AzADServicePrincipal @PSBoundParam …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Encountered an internal server error.
DEBUG: [Finally]: Getting exception 'Microsoft.Azure.Commands.Common.Exceptions.AzPSCloudException: InternalException' from response
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: AzureQoSEvent: Module: Az.Resources:6.7.0; CommandName: Update-AzADServicePrincipal; PSVersion: 7.3.5; IsSuccess: False; Duration: 00:00:02.8721676; Exception: InternalException;
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 7.3.5
PSEdition Core
GitCommitId 7.3.5
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
PS C:\> Get-Module Az*
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.12.3 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script 6.7.0 Az.Resources {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment…}
PS C:\> Resolve-AzError
DEBUG: Got version 0 of Az
DEBUG: Got version 0 of Az.Accounts
DEBUG: 2:11:51 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 2:11:51 PM - using account id '[email protected]'...
DEBUG: 2:11:51 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' :
The `Resolve-Error` alias will be removed in a future release. Please change any scripts that use this alias to use `Resolve-AzError` instead.
Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.
HistoryId: 14
Message : [Service_InternalServerError] : Encountered an internal server error.
StackTrace :
Exception : System.Exception
InvocationInfo : {Update-AzADServicePrincipal_UpdateExpanded}
Line : $sp=Az.MSGraph.internal\Update-AzADServicePrincipal @PSBoundParameters
Position : At C:\Program Files\PowerShell\Modules\Az.Resources\6.7.0\MSGraph.Autorest\custom\Update-AzADServicePrincipal.ps1:631 char:5
+ $sp=Az.MSGraph.internal\Update-AzADServicePrincipal @PSBoundParam …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 14
DEBUG: 2:11:51 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent: Module: Az.Accounts:2.12.3; CommandName: Resolve-AzError; PSVersion: 7.3.5; IsSuccess: True; Duration: 00:00:00.0987247
DEBUG: 2:11:51 PM - [ConfigManager] Got [True] from [EnableDataCollection], Module = [], Cmdlet = [].
DEBUG: 2:11:51 PM - ResolveError end processing.
PS C:\>
Environment data
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 7.3.5
PSEdition Core
GitCommitId 7.3.5
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Module versions
PS C:\> Get-Module Az*
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.12.3 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script 6.7.0 Az.Resources {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment…}
Error output
PS C:\> Resolve-AzError
DEBUG: Got version 0 of Az
DEBUG: Got version 0 of Az.Accounts
DEBUG: 2:11:51 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 2:11:51 PM - using account id '[email protected]'...
DEBUG: 2:11:51 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' :
The `Resolve-Error` alias will be removed in a future release. Please change any scripts that use this alias to use `Resolve-AzError` instead.
Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.
HistoryId: 14
Message : [Service_InternalServerError] : Encountered an internal server error.
StackTrace :
Exception : System.Exception
InvocationInfo : {Update-AzADServicePrincipal_UpdateExpanded}
Line : $sp=Az.MSGraph.internal\Update-AzADServicePrincipal @PSBoundParameters
Position : At C:\Program Files\PowerShell\Modules\Az.Resources\6.7.0\MSGraph.Autorest\custom\Update-AzADServicePrincipal.ps1:631 char:5
+ $sp=Az.MSGraph.internal\Update-AzADServicePrincipal @PSBoundParam …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 14
DEBUG: 2:11:51 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent: Module: Az.Accounts:2.12.3; CommandName: Resolve-AzError; PSVersion: 7.3.5; IsSuccess: True; Duration: 00:00:00.0987247
DEBUG: 2:11:51 PM - [ConfigManager] Got [True] from [EnableDataCollection], Module = [], Cmdlet = [].
DEBUG: 2:11:51 PM - ResolveError end processing.
Adding @VeryEarly to double confirm if the script is OK. If it is, I suggest submitting an ICM to ask Microsoft Graph team for more information about the error.
Hi @tksh164 ,
Please reach out to Microsoft Graph team for detail about how to use 'appRoleAssignedTo'.
Close it since it is an issue of MS Graph.