You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After role assignment, AADRoleAssignmentScheduleRequest is unable to find the assignment. DSC throws the error: The Role assignment already exists. I believe this is due to Get-MgBetaRoleManagementDirectoryRoleAssignmentScheduleRequest being filtered by the Role template. See sample powershell script below where a custom role can be identified by either the TemplateId or the RoleDefinitionId.
$AppObjGuid='4d34cfbe-915d-4d30-9459-67324a6e12e0'# https://microsoft365dsc.com/resources/azure-ad/AADRoleAssignmentScheduleRequest/
AADRoleAssignmentScheduleRequest 'AADRoleAssignmentScheduleRequest-appasignment' {
DependsOn =@(
'[AADApplication]AADApplication-Microsoft365DSC''[AADApplication]AADApplication-Appname''[AADServicePrincipal]AADServicePrincipal-Appname''[AADRoleDefinition]AADRoleDefinition-CustomeRoleAppmyOrgCredUpdate'
)
Principal ='Appname'### L1|Group that is assigned to eligible assignment
RoleDefinition ='Custom. Role'### L1|Role that is being targetted for eligible assignment
PrincipalType ='ServicePrincipal'### L3|Represents the type of principal to assign the request to. Accepted values are: Group and User.
DirectoryScopeId ='/4d34cfbe-915d-4d30-9459-67324a6e12e0'#+ $AppObjGuid ### L3|Identifier of the directory object representing the scope of the role eligibility.# Id = ''# AppScopeId = 'Appname' ## object id; 4d34cfbe-915d-4d30-9459-67324a6e12e0
Action ='AdminAssign'### L2|Represents the type of operation on the role eligibility request.# IsValidationOnly
Justification ='Assigning permanent eligibility for for service principal team'#
IsValidationOnly =$false
ScheduleInfo = MSFT_AADRoleAssignmentScheduleRequestSchedule {
startDateTime ='2023-09-01T02:40:44Z'
expiration = MSFT_AADRoleAssignmentScheduleRequestScheduleExpiration {
type ='noExpiration'
}
}
# TicketInfo
Ensure ='Present'
ApplicationId =$ApplicationId
TenantId =$TenantId
CertificateThumbprint =$Thumbprint
}
Verbose logs showing the problem
### Error Message##[error][RoleAssignmentExists] : The Role assignment already exists.+ CategoryInfo : InvalidOperation: ({ Headers =, b...heduleRequest }:) [], CimException
+ FullyQualifiedErrorId : RoleAssignmentExists,Microsoft.Graph.Beta.PowerShell.Cmdlets.NewMgBetaRoleManagementDire
ctoryRoleAssignmentScheduleRequest_CreateExpanded
+ PSComputerName : localhost
VERBOSE: [LCM-]: LCM: [ EndSet ]
[[AADRoleAssignmentScheduleRequest]AADRoleAssignmentScheduleRequest-appasignment::[AzureAD]AzureAD_Configuration] in2.8770 seconds.
##[error]The PowerShell DSC resource '[AADRoleAssignmentScheduleRequest]AADRoleAssignmentScheduleRequest-appasignment::[AzureAD]AzureAD_Configuration' with
SourceInfo 'C:\AzurePipeline-Agent\_work\1\s\M365Config\0.0.1\DSCResources\AzureAD\AzureAD.schema.psm1::66::5::AADRoleAssignmentScheduleRequest' threw one or more non-terminating errors while running the Set-TargetResource functionality.
These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more
details.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider
+ PSComputerName : localhost
### Get Request to Graph
Displaying debug messages from Powershell DSC resource:
ResourceID : [AADRoleAssignmentScheduleRequest]AADRoleAssignmentScheduleRequest-appasignment::[AzureAD]AzureAD_Configuration
Message : [LCM-]: [[AADRoleAssignmentScheduleRequest]AADRoleAssignmentScheduleRequest-appasignment::[AzureAD]AzureAD_Configuration] ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://graph.microsoft.com/beta/roleManagement/directory/roleAssignmentScheduleRequests?$filter=PrincipalId eq '131d3946-d3bc-47b4-8d68-c6ce4f5efe00' and RoleDefinitionId eq 'c9138e48-33ad-4443-9ba2-e5c14cc517f4' and DirectoryScopeId eq '/4d34cfbe-915d-4d30-9459-67324a6e12e0'
Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.20348; en-US),PowerShell/5.1.20348.2849
Accept-Encoding : gzip
SdkVersion : graph-powershell-beta/2.25.0
client-request-id : ed27c22e-47bf-480f-bb68-6e6ec364703e
Body:
MachineName
LCM-.
Payload.JobId
{242912C7-B6AE-11EF-BAD7-02EE0AFD4B61}
Payload.MessageBody
[LCM-]: [[AADRoleAssignmentScheduleRequest]AADRoleAssignmentScheduleRequest-appasignment::[AzureAD]AzureAD_Configuration] ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://graph.microsoft.com/beta/roleManagement/directory/roleAssignmentScheduleRequests?$filter=PrincipalId eq '131d3946-d3bc-47b4-8d68-c6ce4f5efe00' and RoleDefinitionId eq 'c9138e48-33ad-4443-9ba2-e5c14cc517f4' and DirectoryScopeId eq '/4d34cfbe-915d-4d30-9459-67324a6e12e0'
Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.20348; en-US),PowerShell/5.1.20348.2849
Accept-Encoding : gzip
SdkVersion : graph-powershell-beta/2.25.0
client-request-id : ed27c22e-47bf-480f-bb68-6e6ec364703e
Body:
Payload.ResourceId
[AADRoleAssignmentScheduleRequest]AADRoleAssignmentScheduleRequest-appasignment::[AzureAD]AzureAD_Configuration
ProcessID
2692
ProviderName
Microsoft-Windows-DSC
### Returned Message
Displaying debug messages from Powershell DSC resource:
ResourceID : [AADRoleAssignmentScheduleRequest]AADRoleAssignmentScheduleRequest-appasignment::[AzureAD]AzureAD_Configuration
Message : [LCM-]: [[AADRoleAssignmentScheduleRequest]AADRoleAssignmentScheduleRequest-appasignment::[AzureAD]AzureAD_Configuration] ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000request-id : e0a1a9f7-7243-4527-b5db-df5d98d86827
client-request-id : ed27c22e-47bf-480f-bb68-6e6ec364703e
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"West US 2","Slice":"E","Ring":"4","ScaleUnit":"003","RoleInstance":"CO1PEPF00004A98"}}
OData-Version : 4.0
Cache-Control : private
Date : Tue,10 Dec 202404:22:31 GMT
Body:
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#roleManagement/directory/roleAssignmentScheduleRequests","value": []
}
MachineName
LCM-.
Payload.JobId
{242912C7-B6AE-11EF-BAD7-02EE0AFD4B61}
Payload.MessageBody
[LCM-]: [[AADRoleAssignmentScheduleRequest]AADRoleAssignmentScheduleRequest-appasignment::[AzureAD]AzureAD_Configuration] ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000request-id : e0a1a9f7-7243-4527-b5db-df5d98d86827
client-request-id : ed27c22e-47bf-480f-bb68-6e6ec364703e
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"West US 2","Slice":"E","Ring":"4","ScaleUnit":"003","RoleInstance":"CO1PEPF00004A98"}}
OData-Version : 4.0
Cache-Control : private
Date : Tue,10 Dec 202404:22:31 GMT
Body:
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#roleManagement/directory/roleAssignmentScheduleRequests","value": []
}
Payload.ResourceId
[AADRoleAssignmentScheduleRequest]AADRoleAssignmentScheduleRequest-appasignment::[AzureAD]AzureAD_Configuration
ProcessID
2692
ProviderName
Microsoft-Windows-DSC
Description of the issue
After role assignment, AADRoleAssignmentScheduleRequest is unable to find the assignment. DSC throws the error:
The Role assignment already exists
. I believe this is due toGet-MgBetaRoleManagementDirectoryRoleAssignmentScheduleRequest
being filtered by the Role template. See sample powershell script below where a custom role can be identified by either theTemplateId
or theRoleDefinitionId
.Microsoft365DSC/Modules/Microsoft365DSC/DSCResources/MSFT_AADRoleAssignmentScheduleRequest/MSFT_AADRoleAssignmentScheduleRequest.psm1
Line 148 in 55ba015
In separate test tenant
Powershell calls to search for Assignment
Microsoft 365 DSC Version
1.24.1204.1
Which workloads are affected
Azure Active Directory (Entra ID)
The DSC configuration
Verbose logs showing the problem
Environment Information + PowerShell Version
The text was updated successfully, but these errors were encountered: