snoad icon indicating copy to clipboard operation
snoad copied to clipboard

rolegrants non functioning

Open jon-parodi opened this issue 4 years ago • 3 comments

on line #221 you have flattened the rolegrants to only contain users on line #288 you attempt to read from $CurrentSnowflakeGrants where granted_to -eq ROLE

With this configuration, $currentRoleGranteeRoles = $currentSnowflakeRoleGrants | Where-Object {$_.role -eq $roleName -and $_.granted_to -eq 'ROLE'} | %{$_.grantee_name} will always return empty

jon-parodi avatar Jun 04 '20 01:06 jon-parodi

I haven't tested the script yet but it seems you are right @jparodi . Although it seems like this has been used in production for a long time by several people. Any chance you remember if you came to any conclusion about this?

FredericoCoelhoNunes avatar Mar 14 '22 14:03 FredericoCoelhoNunes

sorry all, for some reason I didn't notice this issue appear back in 2020.

Looking over the code, @jparodi is correct - there's a whole section of ineffective code.

I think the impact here would be that for nested AD groups, the script would continue to grant roles to other roles even if they already exist (not a problem), and if a nested group were removed in AD it wouldn't reflect correctly in Snowflake (this is a problem).

My guess as to why this has never been noticed, is I doubt many people use a lot of nested groups.

I also wonder now that Microsoft have come to the party with User Provisioning for Azure AD, this script may finally not be needed?

Currently I don't belong to an AD environment, so it's tricky for me to fix the issue and comment on the new Microsoft feature.

jamesweakley avatar Mar 16 '22 03:03 jamesweakley

^a comment about the User Provisioning for Azure AD: it's mentioned here that nested groups still aren't supported. I've already opened a feature request on Azure's forum here.

FredericoCoelhoNunes avatar Mar 16 '22 10:03 FredericoCoelhoNunes