Get-AzureRmRoleAssignment throws unhandled exception on Service Provider account - Azure Stack
Description
Similar issues to https://github.com/Azure/azure-powershell/issues/3407 and https://github.com/Azure/azure-powershell/issues/5192
When you run Get-AzureRmRoleAssignment usung SPN it throws an exception: Exception of type 'Microsoft.Rest.Azure.CloudException' was thrown.
The same command when you are authenticated with Azure Public using the same SPN works fine.
RoleAssignmentId : /subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/providers/Microsoft.Authorization/roleAssignments/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Scope : /subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
DisplayName : AppName
SignInName :
RoleDefinitionName : Owner
RoleDefinitionId : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ObjectId : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ObjectType : ServicePrincipal
DEBUG: AzureQoSEvent: CommandName - Get-AzureRmRoleAssignment; IsSuccess - True; Duration - 00:00:00.9284247; Exception - ;
DEBUG: Finish sending metric.
DEBUG: 14:47:38 - GetAzureRoleAssignmentCommand end processing.
DEBUG: 14:47:38 - GetAzureRoleAssignmentCommand end processing.
Script/Steps for Reproduction
Get-AzureRmRoleAssignment : Exception of type 'Microsoft.Rest.Azure.CloudException' was thrown.
At line:1 char:1
+ Get-AzureRmRoleAssignment
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureRmRoleAssignment], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleAssignmentCommand
Debug excerpt
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
Forbidden
Headers:
Pragma : no-cache
ocp-aad-diagnostics-server-name: PXcZOnv52wNkcN//gwm5gd7HoWlTIiHfzW4JbWZd9IM=
request-id : e10aaedd-950b-45b6-ac11-6f1bb20b7664
client-request-id : abe6d9e7-22c4-4cb0-8c0c-230afd8f3893
x-ms-dirapi-data-contract-version: 1.6
ocp-aad-session-key : DE1YsWOn1SZQoDQBCj9gS_O5YIsQ3UchlKrtDisGMeHszB5y5azbHNrG4yDoAL3jGZ-rQocYuOqtAS7v_xvKco4_zOJPdvwpcUsdASXrnMjBEEmdPVGLWZpVFqJQEa0C.EzfJAD5NKqxUIekAqPSt2Ddpe3YVlDFechRbZ2e08TM
X-Content-Type-Options : nosniff
DataServiceVersion : 3.0;
Strict-Transport-Security : max-age=31536000; includeSubDomains
Access-Control-Allow-Origin : *
Duration : 531985
Cache-Control : no-cache
Server : Microsoft-IIS/10.0
X-AspNet-Version : 4.0.30319
X-Powered-By : ASP.NET,ASP.NET
Date : Mon, 09 Jul 2018 13:28:47 GMT
Body:
{
"odata.error": {
"code": "Authorization_RequestDenied",
"message": {
"lang": "en",
"value": "Insufficient privileges to complete the operation."
}
}
}
Get-AzureRmRoleAssignment : Exception of type 'Microsoft.Rest.Azure.CloudException' was thrown.
At line:1 char:1
+ Get-AzureRmRoleAssignment
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureRmRoleAssignment], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleAssignmentCommand
DEBUG: AzureQoSEvent: CommandName - Get-AzureRmRoleAssignment; IsSuccess - False; Duration - 00:00:00.4545877; Exception - Microsoft.Rest.Azure.CloudException: Exception of type 'Microsoft.Rest.Azure.CloudException' was thrown.
at Microsoft.Azure.Graph.RBAC.Version1_6.ObjectsOperations.<GetObjectsByObjectIdsWithHttpMessagesAsync>d__6.MoveNext() in D:\workspace\powershell-sign\src\Common\Commands.Common.Graph.RBAC\ObjectsOperations.cs:line 266
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Graph.RBAC.Version1_6.ObjectsOperationsExtensions.<GetObjectsByObjectIdsAsync>d__3.MoveNext() in D:\workspace\powershell-sign\src\Common\Commands.Common.Graph.RBAC\ObjectsOperationsExtensions.cs:line 77
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Graph.RBAC.Version1_6.ObjectsOperationsExtensions.GetObjectsByObjectIds(IObjectsOperations operations, GetObjectsParameters parameters) in D:\workspace\powershell-sign\src\Common\Commands.Common.Graph.RBAC\ObjectsOperationsExtensions.cs:line 60
at Microsoft.Azure.Graph.RBAC.Version1_6.ActiveDirectory.ActiveDirectoryClient.GetObjectsByObjectId(List`1 objectIds) in D:\workspace\powershell-sign\src\Common\Commands.Common.Graph.RBAC\ActiveDirectory\ActiveDirectoryClient.cs:line 274
at Microsoft.Azure.Commands.Resources.Models.Authorization.AuthorizationClientExtensions.ToPSRoleAssignments(IEnumerable`1 assignments, List`1 roleDefinitions, AuthorizationClient policyClient, ActiveDirectoryClient activeDirectoryClient, Boolean excludeAssignmentsForDeletedPrincipals) in D:\workspace\powershell-sign\src\ResourceManager\Resources\Commands.Resources\Models.Authorization\AuthorizationClientExtensions.cs:line 120
at Microsoft.Azure.Commands.Resources.Models.Authorization.AuthorizationClient.FilterRoleAssignments(FilterRoleAssignmentsOptions options, String currentSubscription) in D:\workspace\powershell-sign\src\ResourceManager\Resources\Commands.Resources\Models.Authorization\AuthorizationClient.cs:line 265
at Microsoft.Azure.Commands.Resources.GetAzureRoleAssignmentCommand.ExecuteCmdlet() in D:\workspace\powershell-sign\src\ResourceManager\Resources\Commands.Resources\RoleAssignments\GetAzureRoleAssignmentCommand.cs:line 216
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord() in D:\workspace\powershell-sign\src\Common\Commands.Common\AzurePSCmdlet.cs:line 639;
DEBUG: Finish sending metric.
DEBUG: 14:28:48 - GetAzureRoleAssignmentCommand end processing.
DEBUG: 14:28:48 - GetAzureRoleAssignmentCommand end processing.
Module Version
Get-Module
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Binary 2.0.1.16 AzureAD {Add-AzureADApplicationOwner, Add-AzureADDeviceRegisteredOwner, Add-AzureADDeviceRegisteredUser, Add-AzureADDirectoryRoleMember...}
Script 0.11.1 AzureRM.AzureStackAdmin {Add-AzsGalleryItem, Add-AzsResourceProviderManifest, Add-AzsUsageConnection, Get-AzsGalleryItem...}
Script 0.10.9 AzureRM.AzureStackStorage {Get-AzsBlobService, Get-AzsBlobServiceMetric, Get-AzsBlobServiceMetricDefinition, Get-AzsQueueService...}
Script 3.4.1 AzureRM.KeyVault {Add-AzureKeyVaultCertificate, Add-AzureKeyVaultCertificateContact, Add-AzureKeyVaultKey, Add-AzureKeyVaultManagedStorageAccount...}
Script 3.4.1 AzureRM.Profile {Add-AzureRmAccount, Add-AzureRmEnvironment, Clear-AzureRmContext, Disable-AzureRmContextAutosave...}
Script 4.4.1 AzureRM.Resources {Export-AzureRmResourceGroup, Find-AzureRmResource, Find-AzureRmResourceGroup, Get-AzureRmADAppCredential...}
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}
Manifest 3.0.0.0 Microsoft.PowerShell.Security {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-AuthenticodeSignature...}
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Manifest 3.0.0.0 Microsoft.WSMan.Management {Connect-WSMan, Disable-WSManCredSSP, Disconnect-WSMan, Enable-WSManCredSSP...}
Script 0.2.0 PowerShellEditorServices.Commands {ConvertFrom-ScriptExtent, ConvertTo-ScriptExtent, Find-Ast, Get-Token...}
Script 0.2.0 PowerShellEditorServices.VSCode {Close-VSCodeHtmlContentView, New-VSCodeHtmlContentView, Set-VSCodeHtmlContentView, Show-VSCodeHtmlContentView...}
Manifest 1.1 PSDesiredStateConfiguration {Invoke-DscResource, Publish-DscConfiguration, Set-DscLocalConfigurationManager, Start-DscConfiguration...}
Environment Data
$PSVersionTable
Name Value
---- -----
PSVersion 5.1.17134.112
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17134.112
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Additional issue with the command is as follows. - ONLY ON AZURE STACK on public Azure it works
On NetCore
PS C:\> get-module
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 0.12.0 AzureRM.Profile.Netcore {Add-AzureRmEnvironment, Clear-AzureRmContext, Clear-Azure...
Script 0.12.0 AzureRM.Resources.Netcore {Add-AzureRmADGroupMember, Export-AzureRmResourceGroup, Ge...
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-Item, Clear-ItemPropert...
Manifest 3.0.0.0 Microsoft.PowerShell.Security {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl...
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Script 1.1.7.0 PackageManagement {Find-Package, Find-PackageProvider, Get-Package, Get-Pack...
Script 1.6.0 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Find-RoleCap...
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.2
PSEdition Core
GitCommitId v6.0.2
OS Microsoft Windows 10.0.14393
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-AzureRmRoleAssignment
Get-AzureRmRoleAssignment : The resource type 'roleAssignments' could not be found in the namespace 'Microsoft.Authoriza
tion' for api version '2018-01-01-preview'. The supported api-versions are '2014-04-01-preview,2014-07-01-preview,2014-1
0-01-preview,2015-05-01-preview,2015-06-01,2015-07-01'.
At line:1 char:1
+ Get-AzureRmRoleAssignment
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureRmRoleAssignment], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleAssignmentCommand
On Desktop Powershell Latest modules:
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.14393.2312
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.2312
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
PS C:\> get-module
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 5.3.1 AzureRM.profile {Add-AzureRmEnvironment, Clear-AzureRmContext, Clear-Azure...
Script 6.2.0 AzureRM.Resources {Add-AzureRmADGroupMember, Export-AzureRmResourceGroup, Ge...
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con...
Manifest 3.0.0.0 Microsoft.PowerShell.Security {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl...
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Binary 1.0.0.1 PackageManagement {Find-Package, Find-PackageProvider, Get-Package, Get-Pack...
Script 1.0.0.1 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Find-RoleCap...
PS C:\> Get-AzureRmRoleAssignment
Get-AzureRmRoleAssignment : The resource type 'roleAssignments' could not be found in the namespace
'Microsoft.Authorization' for api version '2018-01-01-preview'. The supported api-versions are
'2014-04-01-preview,2014-07-01-preview,2014-10-01-preview,2015-05-01-preview,2015-06-01,2015-07-01'.
At line:1 char:1
+ Get-AzureRmRoleAssignment
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureRmRoleAssignment], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleAssignmentCommand
As with the previous issues it appears that Azure Active Directory permissions are to be blamed.
Workaround:
# Connect to Azure Active Directory as your Azure Global Admin
Connect-AzureAD -Credential $AzureCredAdmin -TenantId $TenantDomain
$AppGet = Get-AzureRmADApplication -DisplayNameStartWith "AppName"
# Grant Permission to Azure Active Directory to SPN
$req = New-Object -TypeName "Microsoft.Open.AzureAD.Model.RequiredResourceAccess"
$req.ResourceAppId = "00000002-0000-0000-c000-000000000000"
$acc1 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "5778995a-e1bf-45b8-affa-663a9f3f4d04","Role"
$acc2 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "abefe9df-d5a9-41c6-a60b-27b38eac3efb","Role"
$acc3 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "78c8a3c8-a07e-4b9e-af1b-b5ccab50a175","Role"
$acc4 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "1138cb37-bd11-4084-a2b7-9f71582aeddb","Role"
$acc5 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "9728c0c4-a06b-4e0e-8d1b-3d694e8ec207","Role"
$acc6 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "824c81eb-e3f8-4ee6-8f6d-de7f50d565b7","Role"
$acc7 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "1cda74f2-2616-4834-b122-5cb1b07f8a59","Role"
$acc8 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "aaff0dfd-0295-48b6-a5cc-9f465bc87928","Role"
$acc9 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "a42657d6-7f20-40e3-b6f0-cee03008a62a","Scope"
$acc10 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "5778995a-e1bf-45b8-affa-663a9f3f4d04","Scope"
$acc11 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "78c8a3c8-a07e-4b9e-af1b-b5ccab50a175","Scope"
$acc12 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "970d6fa6-214a-4a9b-8513-08fad511e2fd","Scope"
$acc13 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "6234d376-f627-4f0f-90e0-dff25c5211a3","Scope"
$acc14 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "c582532d-9d9e-43bd-a97c-2667a28ce295","Scope"
$acc15 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "cba73afc-7f69-4d86-8450-4978e04ecd1a","Scope"
$acc16 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "311a71cc-e848-46a1-bdf8-97ff7156d8e6","Scope"
$acc17 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "2d05a661-f651-4d57-a595-489c91eda336","Scope"
$req.ResourceAccess = $acc1,$acc2,$acc3,$acc4,$acc5,$acc6,$acc7,$acc8,$acc9,$acc10,$acc11,$acc12,$acc13,$acc14,$acc15,$acc16,$acc17
$AzureADPermissions = Set-AzureADApplication -ObjectId $AppGet.ObjectId.Guid -RequiredResourceAccess $req
$AzureADPermissionsGet = Get-AzureADApplication -ObjectId $AppGet.ObjectId.Guid | Select-Object -Property *
$AzureADPermissionsGet
@cblackuk Hey Chris, I believe this is due to the fact that the AzureStack module uses version 4.4.1 of AzureRM.Resources, and the fix for this issue was introduced around version 5.4.0.
@bganapa Hey Bala, do you know if you all plan on consuming a later version of the AzureRM.Resources module for AzureStack in the near future?
CC: @darshanhs90
@cormacpayne I expected that module version is to blame but I raised it for awareness and to potentially "force" AZS to use newer module :-) Thanks for checking and asking on my behalf.
@cblackuk sorry that you are running in to this issue. We will be releasing a new azure stack specific resources module in August end which will have the fix for this. The latest module does not really work against azure stack as azure stack does not support the api version needed.
@bganapa Thanks for a quick reply. Will the new modules also be release for .NET Core?
No, the august azurestack release will not be with .Net core support. Azure powershell is moving to have a single Az Module base on .Net Standard by Aug/Sep. We will have the support only after that, though we have already started working towards having .net core support for azurestack specific modules. Exact timings of the release with .net core is yet to be determined
@bganapa Thanks for the confirmation! Really appreciate it!
Just to add to it.
On NetCore modules you get the same error:
PS C:\> Get-AzureRmRoleAssignment
Get-AzureRmRoleAssignment : The resource type 'roleAssignments' could not be found in the namespace 'Microsoft.Authoriza
tion' for api version '2018-01-01-preview'. The supported api-versions are '2014-04-01-preview,2014-07-01-preview,2014-1
0-01-preview,2015-05-01-preview,2015-06-01,2015-07-01'.
At line:1 char:1
+ Get-AzureRmRoleAssignment
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureRmRoleAssignment], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleAssignmentCommand
Get-Module
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 0.12.0 AzureRM.Profile.Netcore {Add-AzureRmEnvironment, Clear-AzureRmContext, Clear-Azure...
Script 0.12.0 AzureRM.Resources.Netcore {Add-AzureRmADGroupMember, Export-AzureRmResourceGroup, Ge...
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-Item, Clear-ItemPropert...
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Script 1.1.7.0 PackageManagement {Find-Package, Find-PackageProvider, Get-Package, Get-Pack...
Script 1.6.0 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Find-RoleCap...
I have same issue when I call it as Service Principal.
$assignments=Get-AzureRmRoleAssignment -IncludeClassicAdministrators
Gathering Role Assignments in Subscription
Get-AzureRmRoleAssignment : Exception of type 'Microsoft.Rest.Azure.CloudException' was thrown.
At line:4 char:18
+ ... $assignments=Get-AzureRmRoleAssignment -IncludeClassicAdministrators
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureRmRoleAssignment], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleAssignmentCommand
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 6.2.1 AzureRM.Resources {Get-AzureRmProviderOperation, Remove-AzureRmRoleAssignment, Get-AzureRmRoleAssignment, New-AzureRm...
Script 5.5.2 AzureRM.Resources {Get-AzureRmProviderOperation, Remove-AzureRmRoleAssignment, Get-AzureRmRoleAssignment, New-AzureRm...
Exist any workaround for that? Do you need other details?
I provided a workaround above :-) @svpudik
The only other one would be to use latest module but that does not work with Azure Stack because of unsupported API so my workaround is the best you are going to get atm... I am afraid
Sorry I missed that. I am not sure what are those ID's in argument lists and where I can get them. That are Azure Subscription ID's? Thanks, Svata
On Fri, 27 Jul 2018 at 11:06, Chris Black [email protected] wrote:
I provided a workaround above :-) @svpudik https://github.com/svpudik
The only other one would be to use latest module but that does not work with Azure Stack because of unsupported API so my workaround is the best you are going to get atm... I am afraid
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Azure/azure-powershell/issues/6628#issuecomment-408359331, or mute the thread https://github.com/notifications/unsubscribe-auth/AfIPy3lx2ldIwWQu3rS4Gw0Rg7ot574lks5uKtgigaJpZM4VHvez .
That hopefully should explain it a bit: https://stackoverflow.com/questions/42164581/how-to-configure-a-new-azure-ad-application-through-powershell
We have a new version of AzureRm 2.3.0, AzureRm.Resources 6.0.2 released, I believe the original issue of Get-Assignment should not repro.
Fixed with the new AzureRm module 2.3.0 (released).
Using AzureRm 2.3.0, AzureRm.Resources 6.0.2 got the same error when running the command from an Automation Account.
At line:1160 char:18
+ ... resources = Get-AzureRmRoleAssignment -Scope "/subscriptions/$Subscri ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureRmRoleAssignment], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleAssignmentCommand
Tried the workaround and got the same error.
I am getting the same issue, I am using ### AzureRm.Resources v6.7.0. Is it because of this? last week my script was working fine, but unfortunately that time I hadn't noticed the version history. ` Get-AzureRmRoleAssignment : The client 'e1c558fe-035b-k8re-p9eu-ur89ridkg6dy' with object id 'e1c558fe-035b-k8re-p9eu-ur89ridkg6dy' does not have authorization to perform action 'Microsoft.Authorization/roleAssignments/read' over scope '/subscriptions/98ui78u6-j7s4-0o7u-m8m7-9ie7tu84r9i5/resourceGroups/hew-dev-bi-rg/providers/Microsoft.Authorization' or the scope is invalid. If access was recently granted, please refresh your credentials. At line:2 char:29
- ... ceGroupPermissions = Get-AzureRmRoleAssignment -ResourceGroupName $rg
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- CategoryInfo : CloseError: (:) [Get-AzureRmRoleAssignment], CloudException
- FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleAssignmentCommand `