New-AzureRmADAppCredential failing with Update to existing credential with KeyId is not allowed
Description
Unable to add multiple self-signed certificate to my Azure Ad application using Azure PowerShell command New-AzureRmADAppCredential Seeing the failure recently when using PowerShell, it always used to work fine. Also adding the same certificates from the portal succeeds. My observation : We are trying to update the first certificate in the manifest.xml instead of adding a new certificate. Hence, seeing the failure New-AzureRmADAppCredential : Update to existing credential with KeyId '*******' is not allowed.
Script/Steps for Reproduction
The cert is a self signed valid certificate. I have added it in "\idlsstore\V2Writable\grvalec\uploadcert4.cer" for your reference.
Add the certificate from powershell or portal it succeeds. On adding it or any other certificate it works from the portal but fails from PowerShell.
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate
$cert.Import("C:\Users\grvalec\Desktop\UploadCert4.cer")
$binCert = $cert.GetRawCertData()
$base64Value = [System.Convert]::ToBase64String($binCert)
New-AzureRmADAppCredential -ObjectId
Module Version
Get-Module -Name AzureRM -ListAvailable
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
Script 6.5.0 AzureRM
Environment Data
$PSVersionTable
PS C:\WINDOWS\system32> $PSVersionTable
Name Value
PSVersion 5.1.16299.551 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.16299.551 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1
Debug Output
PS C:\Users\grvalec\Documents> New-AzureRmADAppCredential -ObjectId bbbe8aed-233d-481c-930a-c48d656fa9d5 -CertValue $base64Value
DEBUG: 1:36:57 PM - NewAzureADAppCredentialCommand begin processing with ParameterSet 'ApplicationObjectIdWithCertValueParameterSet'.
DEBUG: 1:36:57 PM - using account id '[email protected]'...
DEBUG: [Common.Authentication]: Authenticating using Account: '[email protected]', environment: 'AzureCloud', tenant: '72f988bf-86f1-41af-91ab-2d7cd011db47'
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/06/2018 08:06:57: f9495ab1-dcb0-43b5-89f4-d206b345a5bb - AcquireTokenHandlerBase: === Token Acquisition started:
Authority: https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/
Resource: https://graph.windows.net/
ClientId: 1950a258-227b-4e31-a9cf-717495945fc2
CacheType: Microsoft.Azure.Commands.Common.Authentication.ProtectedFileTokenCache (2 items)
Authentication Target: User
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/06/2018 08:06:57: - TokenCache: Deserialized 2 items to token cache.
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 08/06/2018 08:06:57: f9495ab1-dcb0-43b5-89f4-d206b345a5bb - TokenCache: Looking up cache for a token...
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/06/2018 08:06:57: f9495ab1-dcb0-43b5-89f4-d206b345a5bb - TokenCache: An item matching the requested resource was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 08/06/2018 08:06:57: f9495ab1-dcb0-43b5-89f4-d206b345a5bb - TokenCache: An expired or near expiry token was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/06/2018 08:06:57: f9495ab1-dcb0-43b5-89f4-d206b345a5bb - TokenCache: A matching item (access token or refresh token or both) was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 08/06/2018 08:06:57: f9495ab1-dcb0-43b5-89f4-d206b345a5bb - <RefreshAccessTokenAsync>d__11: Refreshing access token...
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 08/06/2018 08:06:58: f9495ab1-dcb0-43b5-89f4-d206b345a5bb - TokenCache: Storing token in the cache...
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 08/06/2018 08:06:58: f9495ab1-dcb0-43b5-89f4-d206b345a5bb - TokenCache: An item was stored in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/06/2018 08:06:58: f9495ab1-dcb0-43b5-89f4-d206b345a5bb - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned:
Access Token Hash: GdmKhBmlt42xVMYgMzp7g3gmRBfS+U1zLhUvCcCQmh8=
Refresh Token Hash: xNqHz3cdTREh8+akcygUQUI/Oemf2sexz5rMOyxOs4k=
Expiration Time: 08/06/2018 09:06:58 +00:00
User Hash: z2blcxkBpfKp+QTHYQD4Ot9/NbdspCLHzkI3q+DTpW4=
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/06/2018 08:06:58: - TokenCache: Serializing token cache with 2 items.
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/06/2018 08:06:58: ff39d03c-a8d9-4195-a7a7-3836690da107 - AcquireTokenHandlerBase: === Token Acquisition started:
Authority: https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/
Resource: https://graph.windows.net/
ClientId: 1950a258-227b-4e31-a9cf-717495945fc2
CacheType: Microsoft.Azure.Commands.Common.Authentication.ProtectedFileTokenCache (2 items)
Authentication Target: User
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/06/2018 08:06:58: - TokenCache: Deserialized 2 items to token cache.
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 08/06/2018 08:06:58: ff39d03c-a8d9-4195-a7a7-3836690da107 - TokenCache: Looking up cache for a token...
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/06/2018 08:06:58: ff39d03c-a8d9-4195-a7a7-3836690da107 - TokenCache: An item matching the requested resource was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 08/06/2018 08:06:58: ff39d03c-a8d9-4195-a7a7-3836690da107 - TokenCache: 59.9984325883333 minutes left until token in cache expires
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/06/2018 08:06:58: ff39d03c-a8d9-4195-a7a7-3836690da107 - TokenCache: A matching item (access token or refresh token or both) was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/06/2018 08:06:58: ff39d03c-a8d9-4195-a7a7-3836690da107 - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned:
Access Token Hash: GdmKhBmlt42xVMYgMzp7g3gmRBfS+U1zLhUvCcCQmh8=
Refresh Token Hash: xNqHz3cdTREh8+akcygUQUI/Oemf2sexz5rMOyxOs4k=
Expiration Time: 08/06/2018 09:06:58 +00:00
User Hash: z2blcxkBpfKp+QTHYQD4Ot9/NbdspCLHzkI3q+DTpW4=
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://graph.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/applications/bbbe8aed-233d-481c-930a-c48d656fa9d5/keyCredentials?api-version=1.6
Headers:
x-ms-client-request-id : f11b9020-e8f7-4c4d-9371-82d8120b8b36
accept-language : en-US
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Pragma : no-cache
ocp-aad-diagnostics-server-name: UZ7yhbgtTo9/ftwLdyoE6fdETi9vxd/xPk8Oe2Zi1w0=
request-id : 4d603c5e-71bf-4c72-9b3d-2c471dbc4a7e
client-request-id : 07f95948-2f3e-4f34-95d4-682cc52b0692
x-ms-dirapi-data-contract-version: 1.6
ocp-aad-session-key :
9nix_QwE1byQQBvdjooO8yfiFughk6pHeCP0U8IrQPXWAj8pLPHTenvhqlduu_nYcEG4cHCFOOQoBnoCod4DEylqdeHmQRmyKvcQGhq2nnnPS6XzRFGnKpdnU3YHK_oz.7mR8zeYEfU41_n0QLpW1XUg4gb_f5UUyzL__pQX98UI
X-Content-Type-Options : nosniff
DataServiceVersion : 3.0;
Strict-Transport-Security : max-age=31536000; includeSubDomains
Access-Control-Allow-Origin : *
Duration : 9209647
Cache-Control : no-cache
Date : Mon, 06 Aug 2018 08:06:59 GMT
Server : Microsoft-IIS/10.0
X-AspNet-Version : 4.0.30319
X-Powered-By : ASP.NET
Body:
{
"odata.metadata": "https://graph.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/$metadata#Collection(Microsoft.DirectoryServices.KeyCredential)",
"value": [
{
"customKeyIdentifier": "PubA4V1J/Go68tpfi+QZ2LQ5hag=",
"endDate": "2019-08-27T06:08:31Z",
"keyId": "5d6f1ed5-48bd-44da-8cf6-3b5d5b516ed8",
"startDate": "2018-07-22T00:00:00Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": "JFhrGeN01ZuOkQk5Ge7uIVMVQl8=",
"endDate": "2019-07-21T05:06:45Z",
"keyId": "548e6c00-b4e1-4d1d-8d24-ccdc460c288b",
"startDate": "2018-06-15T07:00:00Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": "PubA4V1J/Go68tpfi+QZ2LQ5hag=",
"endDate": "2019-08-27T06:08:31Z",
"keyId": "99ad87a3-8855-4228-bf6b-b9b25bb5f6a6",
"startDate": "2018-07-22T00:00:00Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-07-23T14:18:11.6395878Z",
"keyId": "a1afc871-c696-4733-bb12-97e7b0d87358",
"startDate": "2018-07-23T14:18:11.6395878Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-07-23T13:05:10.038825Z",
"keyId": "d0e212f8-e0e0-4c0d-a856-fb06ac683614",
"startDate": "2018-07-23T13:05:10.038825Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-25T10:35:28.2545613Z",
"keyId": "79f1311a-0b23-461b-acdd-c246ebd0fc9d",
"startDate": "2018-06-25T10:35:28.2545613Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-25T10:18:34.1383312Z",
"keyId": "5c2cba19-ee84-470f-b427-64a75e26e70f",
"startDate": "2018-06-25T10:18:34.1383312Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-25T05:51:13.9971748Z",
"keyId": "a42b005f-86a8-443f-b6b6-2a877f6c09b3",
"startDate": "2018-06-25T05:51:13.9971748Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-25T04:37:30.2059225Z",
"keyId": "2b192934-0e61-4be1-abb7-f301138647ec",
"startDate": "2018-06-25T04:37:30.2059225Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-25T03:57:21.2776853Z",
"keyId": "82ef7b22-2ed6-4127-9809-c4970eff0ffa",
"startDate": "2018-06-25T03:57:21.2776853Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-22T14:15:48.7860129Z",
"keyId": "548d0dcf-6496-4acb-9466-069c045c5bd2",
"startDate": "2018-06-22T14:15:48.7860129Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-22T13:53:36.3786722Z",
"keyId": "19105faf-eb21-4194-9e81-654e596ca302",
"startDate": "2018-06-22T13:53:36.3786722Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-22T13:05:09.9505626Z",
"keyId": "58343bb0-38a1-4ed6-89ae-dad3c014a766",
"startDate": "2018-06-22T13:05:09.9505626Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-22T12:53:39.325511Z",
"keyId": "62a55bd6-8de1-4239-90d1-c628b0231818",
"startDate": "2018-06-22T12:53:39.325511Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-22T12:24:33.8479535Z",
"keyId": "69ef16e8-57cc-4c0c-b065-8ad0e4c5f926",
"startDate": "2018-06-22T12:24:33.8479535Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-22T10:27:44.7417671Z",
"keyId": "aee8a5c9-bcb7-4ab9-9976-2e63b82088c7",
"startDate": "2018-06-22T10:27:44.7417671Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-22T09:55:49.9239879Z",
"keyId": "1c92cb4b-2c17-410e-a026-e50fc477195d",
"startDate": "2018-06-22T09:55:49.9239879Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-22T09:28:11.7299249Z",
"keyId": "34fd6920-ec56-4e2e-9b15-a25e2c31f8e7",
"startDate": "2018-06-22T09:28:11.7299249Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-22T08:44:00.0134482Z",
"keyId": "063afb22-28de-4501-9b6b-a1b7b98c24d3",
"startDate": "2018-06-22T08:44:00.0134482Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-22T08:13:21.9019759Z",
"keyId": "71e412ae-95f2-4974-9685-e9b83f1dedee",
"startDate": "2018-06-22T08:13:21.9019759Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-22T08:10:58.1945644Z",
"keyId": "b1e51805-01ec-4781-bdb5-d840a8cf90ea",
"startDate": "2018-06-22T08:10:58.1945644Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-22T07:06:21.3759222Z",
"keyId": "9ea16f5b-a5a8-4164-8c7f-5146a97e45c2",
"startDate": "2018-06-22T07:06:21.3759222Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-22T06:28:01.3433885Z",
"keyId": "0133ea5a-aa8a-483f-aeea-fe4931e6217a",
"startDate": "2018-06-22T06:28:01.3433885Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
},
{
"customKeyIdentifier": null,
"endDate": "2019-06-22T05:45:32.7606347Z",
"keyId": "35498d9a-5c36-4b7d-b7cd-875d57a3361a",
"startDate": "2018-06-22T05:45:32.7606347Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
}
]
}
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/06/2018 08:07:00: 07396daf-dae1-473d-bbc8-7e17517f65f5 - AcquireTokenHandlerBase: === Token Acquisition started:
Authority: https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/
Resource: https://graph.windows.net/
ClientId: 1950a258-227b-4e31-a9cf-717495945fc2
CacheType: Microsoft.Azure.Commands.Common.Authentication.ProtectedFileTokenCache (2 items)
Authentication Target: User
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/06/2018 08:07:00: - TokenCache: Deserialized 2 items to token cache.
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 08/06/2018 08:07:00: 07396daf-dae1-473d-bbc8-7e17517f65f5 - TokenCache: Looking up cache for a token...
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/06/2018 08:07:00: 07396daf-dae1-473d-bbc8-7e17517f65f5 - TokenCache: An item matching the requested resource was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 08/06/2018 08:07:00: 07396daf-dae1-473d-bbc8-7e17517f65f5 - TokenCache: 59.979411615 minutes left until token in cache expires
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/06/2018 08:07:00: 07396daf-dae1-473d-bbc8-7e17517f65f5 - TokenCache: A matching item (access token or refresh token or both) was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/06/2018 08:07:00: 07396daf-dae1-473d-bbc8-7e17517f65f5 - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned:
Access Token Hash: GdmKhBmlt42xVMYgMzp7g3gmRBfS+U1zLhUvCcCQmh8=
Refresh Token Hash: xNqHz3cdTREh8+akcygUQUI/Oemf2sexz5rMOyxOs4k=
Expiration Time: 08/06/2018 09:06:58 +00:00
User Hash: z2blcxkBpfKp+QTHYQD4Ot9/NbdspCLHzkI3q+DTpW4=
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
PATCH
Absolute Uri:
https://graph.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/applications/bbbe8aed-233d-481c-930a-c48d656fa9d5/keyCredentials?api-version=1.6
Headers:
x-ms-client-request-id : c53e7750-1171-4075-804b-a61d5a5955f0
accept-language : en-US
Body:
{
"value": [
{
"startDate": "2018-07-22T00:00:00Z",
"endDate": "2019-08-27T06:08:31Z",
"keyId": "5d6f1ed5-48bd-44da-8cf6-3b5d5b516ed8",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-15T07:00:00Z",
"endDate": "2019-07-21T05:06:45Z",
"keyId": "548e6c00-b4e1-4d1d-8d24-ccdc460c288b",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-07-22T00:00:00Z",
"endDate": "2019-08-27T06:08:31Z",
"keyId": "99ad87a3-8855-4228-bf6b-b9b25bb5f6a6",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-07-23T14:18:11.6395878Z",
"endDate": "2019-07-23T14:18:11.6395878Z",
"keyId": "a1afc871-c696-4733-bb12-97e7b0d87358",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-07-23T13:05:10.038825Z",
"endDate": "2019-07-23T13:05:10.038825Z",
"keyId": "d0e212f8-e0e0-4c0d-a856-fb06ac683614",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-25T10:35:28.2545613Z",
"endDate": "2019-06-25T10:35:28.2545613Z",
"keyId": "79f1311a-0b23-461b-acdd-c246ebd0fc9d",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-25T10:18:34.1383312Z",
"endDate": "2019-06-25T10:18:34.1383312Z",
"keyId": "5c2cba19-ee84-470f-b427-64a75e26e70f",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-25T05:51:13.9971748Z",
"endDate": "2019-06-25T05:51:13.9971748Z",
"keyId": "a42b005f-86a8-443f-b6b6-2a877f6c09b3",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-25T04:37:30.2059225Z",
"endDate": "2019-06-25T04:37:30.2059225Z",
"keyId": "2b192934-0e61-4be1-abb7-f301138647ec",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-25T03:57:21.2776853Z",
"endDate": "2019-06-25T03:57:21.2776853Z",
"keyId": "82ef7b22-2ed6-4127-9809-c4970eff0ffa",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-22T14:15:48.7860129Z",
"endDate": "2019-06-22T14:15:48.7860129Z",
"keyId": "548d0dcf-6496-4acb-9466-069c045c5bd2",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-22T13:53:36.3786722Z",
"endDate": "2019-06-22T13:53:36.3786722Z",
"keyId": "19105faf-eb21-4194-9e81-654e596ca302",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-22T13:05:09.9505626Z",
"endDate": "2019-06-22T13:05:09.9505626Z",
"keyId": "58343bb0-38a1-4ed6-89ae-dad3c014a766",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-22T12:53:39.325511Z",
"endDate": "2019-06-22T12:53:39.325511Z",
"keyId": "62a55bd6-8de1-4239-90d1-c628b0231818",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-22T12:24:33.8479535Z",
"endDate": "2019-06-22T12:24:33.8479535Z",
"keyId": "69ef16e8-57cc-4c0c-b065-8ad0e4c5f926",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-22T10:27:44.7417671Z",
"endDate": "2019-06-22T10:27:44.7417671Z",
"keyId": "aee8a5c9-bcb7-4ab9-9976-2e63b82088c7",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-22T09:55:49.9239879Z",
"endDate": "2019-06-22T09:55:49.9239879Z",
"keyId": "1c92cb4b-2c17-410e-a026-e50fc477195d",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-22T09:28:11.7299249Z",
"endDate": "2019-06-22T09:28:11.7299249Z",
"keyId": "34fd6920-ec56-4e2e-9b15-a25e2c31f8e7",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-22T08:44:00.0134482Z",
"endDate": "2019-06-22T08:44:00.0134482Z",
"keyId": "063afb22-28de-4501-9b6b-a1b7b98c24d3",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-22T08:13:21.9019759Z",
"endDate": "2019-06-22T08:13:21.9019759Z",
"keyId": "71e412ae-95f2-4974-9685-e9b83f1dedee",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-22T08:10:58.1945644Z",
"endDate": "2019-06-22T08:10:58.1945644Z",
"keyId": "b1e51805-01ec-4781-bdb5-d840a8cf90ea",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-22T07:06:21.3759222Z",
"endDate": "2019-06-22T07:06:21.3759222Z",
"keyId": "9ea16f5b-a5a8-4164-8c7f-5146a97e45c2",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-22T06:28:01.3433885Z",
"endDate": "2019-06-22T06:28:01.3433885Z",
"keyId": "0133ea5a-aa8a-483f-aeea-fe4931e6217a",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-06-22T05:45:32.7606347Z",
"endDate": "2019-06-22T05:45:32.7606347Z",
"keyId": "35498d9a-5c36-4b7d-b7cd-875d57a3361a",
"usage": "Verify",
"type": "AsymmetricX509Cert"
},
{
"startDate": "2018-08-06T08:06:57.0574247Z",
"endDate": "2019-08-06T08:06:57.0574247Z",
"value":
"MIIDZjCCAk6gAwIBAgIQOsVKbnH/p7JAkus56MVt+zANBgkqhkiG9w0BAQUFADBvMW0wawYDVQQDHmQAQwBCAF8AQQB6AHUAcgBlAEEARABDAGUAcgB0AGYAbwByAE8AZgBmAGwAaQBuAGUAUwBlAGUAZABpAG4AZwBfADYAMwA2ADYAOAAyADYAMwA
wADQANwA3ADQAOQA1ADMANAA4MB4XDTE4MDcyMjAwMDAwMFoXDTE5MDgyNzA0MzcyN1owbzFtMGsGA1UEAx5kAEMAQgBfAEEAegB1AHIAZQBBAEQAQwBlAHIAdABmAG8AcgBPAGYAZgBsAGkAbgBlAFMAZQBlAGQAaQBuAGcAXwA2ADMANgA2ADgAMgA
2ADMAMAA0ADcANwA0ADkANQAzADQAODCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOCMgUgbrvDnXOThxWUR1QzplWwS6Q+mrV7WZV4oZUq4TXM8iSFfWYEcsAd7n5FCydVL4AuGwKvfAwoLCXDFeAJDPZiWOm2GRxvR16y4mNJddadca8c
pUcraC5koslJw+R1xFjGj9zt64QIsoDfL6Deqge2xrTFQhsWUw+xIOjMEu22kIhVq1a6YiKEV8XBbr8y9Xh7FQZdxye3KRhjKjx/Ahl6tYBWQUzBWQh+KNl7TaPF+pbaoB3wzQjCm+XCMB7DbSN/t4LagntPxF77otz14+uGJ63ny+R2YY85IK0B5cqO
ftkTLCECVQwL+bvap+14+Hyhu7IGFf+oJuwCt6S0CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEACJzIZ/FvRyMKe3kZIgQtHK5W61TpRycnn+3EZh2mwIfruo3+NaRjv1N20qrk+54J5al+VkgKXgn8r9atpd3/VwdT4uF1/XCcaVkXBxOw+eIVwP0Ca/8
tQc6faxkjPvqbam+vTkH4/Tmp9BE19kl5NaLCscBEtT0rK329HF1fQk1rOuk6uDvMC/FTBVc6Pg71J8S+ZdW57u2SzZUjXJ2wdnPDah6veIxJDh92oCcFc1rmI+JCpr43k1SbrTnl9fwXJBX3Aqn3UzQvsqyJMbO6SFB4e4xWvN1oSyPsMMwsgt4MdSE
DzAZHarNVNQECEg4M/Wdg7avp8SMNTSxesyPlig==",
"keyId": "481e117f-d764-46b6-b5a6-bf0d2857abbb",
"usage": "Verify",
"type": "AsymmetricX509Cert"
}
]
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
BadRequest
Headers:
ocp-aad-diagnostics-server-name: mHTacVTgCdgP1GdJFFXJTc2fd1fdBzt8bTU1ncSqpFY=
request-id : 77d05edd-aed2-4517-8d0f-b8415ad30ab0
client-request-id : a1dfe4ba-52b9-4bea-b1a8-5fe5392c264e
x-ms-dirapi-data-contract-version: 1.6
ocp-aad-session-key :
RLua05QYu8nWIDKlL1LYJiRDnko6rByqtOnU8mI-_OdWbai4YzmVG2b2gbjx0k0n-yGohbvKIbeozZC0Ixq3Z8B3gAEtgbec2_OXIiqLlZS-xrvkH_lBgiJoGJsAOl7Z.Z2TGcvB8gGjhIRy-VGvPotBdUcOd4ZVbIeKaMgDGRYQ
Strict-Transport-Security : max-age=31536000; includeSubDomains
Access-Control-Allow-Origin : *
Duration : 2203034
Cache-Control : private
Date : Mon, 06 Aug 2018 08:06:59 GMT
Server : Microsoft-IIS/10.0
X-AspNet-Version : 4.0.30319
X-Powered-By : ASP.NET
Body:
{
"odata.error": {
"code": "Request_BadRequest",
"message": {
"lang": "en",
"value": "Update to existing credential with KeyId '5d6f1ed5-48bd-44da-8cf6-3b5d5b516ed8' is not allowed."
},
"date": "2018-08-06T08:07:00",
"requestId": "77d05edd-aed2-4517-8d0f-b8415ad30ab0",
"values": [
{
"item": "PropertyName",
"value": "keyCredentials"
},
{
"item": "PropertyErrorCode",
"value": "KeyNotUpdatable"
}
]
}
}
DEBUG: Caught exception, type: Microsoft.Azure.Graph.RBAC.Version1_6.Models.GraphErrorException
New-AzureRmADAppCredential : Update to existing credential with KeyId '5d6f1ed5-48bd-44da-8cf6-3b5d5b516ed8' is not allowed.
At line:1 char:1
+ New-AzureRmADAppCredential -ObjectId bbbe8aed-233d-481c-930a-c48d656f ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-AzureRmADAppCredential], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ActiveDirectory.NewAzureADAppCredentialCommand
DEBUG: AzureQoSEvent: CommandName - New-AzureRmADAppCredential; IsSuccess - False; Duration - 00:00:03.7798867; Exception - System.Exception: Update to existing credential with KeyId
'5d6f1ed5-48bd-44da-8cf6-3b5d5b516ed8' is not allowed.;
DEBUG: Finish sending metric.
DEBUG: 1:37:01 PM - NewAzureADAppCredentialCommand end processing.
DEBUG: 1:37:01 PM - NewAzureADAppCredentialCommand end processing.
@darshanhs90 Can you take a look at this? Thanks.
Hi
Any update on the issue?
Thanks Gritika
@RbacAsk
@GritikaV If this is working with a previous version, can you share the debug log for the workign version of the script? The debug log above seems to indicate that this operation is not allowed. This could mean it is not allowed due to user permissions, or it is not allowed under this version of the graph API. The debug log for a working invocation would help to figure out the issue.
@markcowl it used to work for version 4.4.1 and 3.7.0. but since the beginning of August it has started to fail for them. Tried it using the latest version and it still fails.
Hi, the fix for this should be included in the Az 1.0 release.
:bell: Routing this issue to @act-identity-squad.
The maintainer confirmed in January 2019 that the fix landed in Az 1.0. Closing as fixed.