Sunday, January 31, 2021

Add user to Azure Data lake workspace Group using PowerShell

$GroupdID = "7519627166" # ID of the group where users need to be added as a member
$bearer_token = "dapi4defcba7682aff5-2"
$workspaceURL ="https://adb-85238717.17.azuredatabricks.net"
#----------------------------------------------------------------------------------------

$url = "$workspaceURL/api/2.0/preview/scim/v2/Groups/$GroupdID"
$headers = @{Authorization = "Bearer $bearer_token"}
$par = '{
  "schemas":[
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "Operations":[
    {
    "op":"add",
    "value":{
        "members":[
           {
              "value": "287484517  - ID of the user which needs to be added into above group"
           }
        ]
      }
    }
  ]
}'

Invoke-WebRequest $url -Method PATCH -Headers $headers -Body $par -ContentType 'application/json'

Get the list of user details for Azure Data lake workspace

$bearer_token = "dapi4de9600e2aff5-2"
$headers = @{"Authorization"= "Bearer $bearer_token"
"Content-Type" = "application/json" }
$hosturl="https://adb-8523889618.17.azuredatabricks.net"
$uri="$hosturl/api/2.0/preview/scim/v2/Users"
Invoke-RestMethod -Method 'Get' -Uri $uri -Headers $headers

Wednesday, January 27, 2021

Add user to Azure Data lake using Powershell with Admin access role.

# Script to add the user to Azure Data Lake workspace with allow-cluster-create access

$url = "https://adb-5890072754.14.azuredatabricks.net/api/2.0/preview/scim/v2/Users"
$groupid= "736317399920" # Get the Admin ID from the other script
$bearer_token = "dapie53ab46ca47e3e3a69f12a75c6-2"

$headers = @{Authorization = "Bearer $bearer_token"}
$par = '{
  "schemas":[
    "urn:ietf:params:scim:schemas:core:2.0:User"
  ],
  "userName":"databrickser-2@globeduc.onmicrosoft.com",
  "displayName":"User 2",
  "groups":[
    {
    "value":"$groupid"
    }
  ]
}'

Invoke-WebRequest $url -Method Post -Headers $headers -Body $par -ContentType 'application/json'

Add user to Azure Data lake using PowerShell

# Script to add the user to Azure Data Lake workspace with allow-cluster-create access

$url = "https://adb-58900332754.14.azuredatabricks.net/api/2.0/preview/scim/v2/Users"
$bearer_token = "dapie53af3e778b46c69f12a75c6-2"
$headers = @{Authorization = "Bearer $bearer_token"}
$par = '{
  "schemas":[
    "urn:ietf:params:scim:schemas:core:2.0:User"
  ],
  "userName":"databricksuser-2@globaleduc.onmicrosoft.com",
  "displayName":"User 2",
  "entitlements":[
    {
    "value":"allow-cluster-create"
    }
  ]
}'

Invoke-WebRequest $url -Method Post -Headers $headers -Body $par -ContentType 'application/json'

PowerShell Script to get the Admin Group ID from the Azure Data Lake workspace

# Script to get the Admin Group ID from the Azure Data Lake workbook

$bearer_token = "47e3e3a69f1676c6-2"
$headers = @{"Authorization"= "Bearer $bearer_token"
"Content-Type" = "application/json" }
$hosturl="https://adb-54.14.azuredatabricks.net"
$uri="$hosturl/api/2.0/preview/scim/v2/Groups"
Invoke-RestMethod -Method 'Get' -Uri $uri -Headers $headers

#-------Below Result Output ---------------------------------------------------
totalResults : 2
startIndex   : 1
itemsPerPage : 2
schemas      : {urn:ietf:params:scim:api:messages:2.0:ListResponse}
Resources    : {@{displayName=users; members=System.Object[]; groups=System.Object[]; id=718921211231112107551}, @{entitlements=System.Object[]; displayName=admins; members=System.Object[]; 
               groups=System.Object[]; id=736317356711920}}

Monday, January 18, 2021

Reassign Sways from a deleted user account

 https://support.microsoft.com/en-us/office/reassign-sways-from-a-deleted-user-account-admin-help-9580e618-3c3e-4d28-a6ef-74c00a997248?ui=en-us&rs=en-us&ad=us

HTML

Script:

JS