Skip to content

Instantly share code, notes, and snippets.

Avatar

Darren Robinson darrenjrobinson

View GitHub Profile
@darrenjrobinson
darrenjrobinson / Get Time Series Prediction.ps1
Last active Jul 21, 2020
Get Prediction using H2O AI for an a Time Series Dataset using the H2OAI PowerShell Module. Associated Blogpost https://blog.darrenjrobinson.com/h2o-ai-powershell-module/
View Get Time Series Prediction.ps1
# Linear Regression Model
$modelAlgorithm = 'glm'
# Time Series Data
$dataCSV = "C:\data\A2B-AX-3y.csv"
$sourceData = Import-Csv $dataCSV
# Last Record as Prediction data
$dataPredict = Import-Csv -Path $dataCSV | Select-Object -Last 1 | export-csv ./dataPredict.csv
@darrenjrobinson
darrenjrobinson / Get Iris Prediction.ps1
Last active Jul 21, 2020
Get Prediction using H2O AI for an Iris using the H2OAI PowerShell Module. Associated Blogpost https://blog.darrenjrobinson.com/h2o-ai-powershell-module/
View Get Iris Prediction.ps1
# Default H2O AI Server running locally via Start-H2O
$url = "http://localhost:54321/3/{0}"
# Neural net algorithm for determining Iris type
$modelAlgorithm = 'deeplearning'
# Get Iris Training data and put on the local filesystem
Invoke-RestMethod -Method Get 'https://raw.githubusercontent.com/DarrenCook/h2o/bk/datasets/iris_wheader.csv' | out-file ./iris_wheader.csv
# Prediction Column
$predictValues = 'class'
View SailPoint IdentityNow PowerShell Module Examples.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@darrenjrobinson
darrenjrobinson / B2B Member Invite
Last active Apr 26, 2020
Convert Azure Active Directory AAD User from Member to B2B Member. Associated blogpost https://blog.darrenjrobinson.com/convert-azure-ad-users-from-members-to-b2b-members/
View B2B Member Invite
# Invite User Request
$inviteDetails = @{
"invitedUserEmailAddress" = $externalEmail.otherMails[0]
"invitedUser" = @{"id" = $updatedUser.id }
"sendInvitationMessage" = $true
"inviteRedirectUrl" = "https://myapps.microsoft.com?ResourceTenantName.com"
"invitedUserMessageInfo" = @{
"messageLanguage" = "en-AU"
"customizedMessageBody" = "Hi $($updatedUser.displayName), Your user account '$($updatedUser.userPrincipalName)' in the Contoso Azure Tenant has been migrated to a Guest account federated to your Fabrikam '$($updatedUser.otherMails[0])' account. After selecting 'Get Started' below you will be able to access Contoso using your Fabrikam account and credentials. All you access and privilages remain intact. Regards, Contoso IT"
}
@darrenjrobinson
darrenjrobinson / Update otherMails AAD User attribute.ps1
Last active Apr 26, 2020
Update AzureAD User otherMails attribute to allow conversion from AAD Member to AAD B2B Member. Associated blogpost https://blog.darrenjrobinson.com/convert-azure-ad-users-from-members-to-b2b-members/
View Update otherMails AAD User attribute.ps1
Import-Module MSAL.PS -RequiredVersion 4.7.1.1
$tenantID = "myTenant.onmicrosoft.com"
$clientID = "yourRegistedAppID"
$clientSecret = (ConvertTo-SecureString "yourRegistedAppSecret" -AsPlainText -Force)
$accessToken = Get-MsalToken -clientID $clientID -clientSecret $clientSecret -tenantID $tenantID -ForceRefresh | Select-Object -Property AccessToken
$users = Invoke-RestMethod -Headers @{Authorization = "Bearer $($accessToken.AccessToken)" } `
-Uri 'https://graph.microsoft.com/v1.0/users' `
View Getting started with a Local PowerShell Jupyter Notebook.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@darrenjrobinson
darrenjrobinson / Audit Azure AD Registered Applications.ps1
Last active Feb 22, 2020
Enumerate Azure AD Registered Apps for expiring credentials and sign-in activity. Associated blogpost https://blog.darrenjrobinson.com/auditing-azure-ad-registered-applications/
View Audit Azure AD Registered Applications.ps1
# Creds
$tenantID = 'yourAADTenantID'
$clientID = 'aadAppID'
$clientSecret = (ConvertTo-SecureString 'aadAppSecret' -AsPlainText -Force)
$accessToken = Get-MsalToken -clientID $clientID -clientSecret $clientSecret -tenantID $tenantID | Select-Object -Property AccessToken
# MS Graph Apps URI
$aadAppsURI = 'https://graph.microsoft.com/v1.0/applications'
# Get Expiring Creds in x Days
$expiryCheck = 60
View Query Azure Log Analytics.ps1
$TenantId = 'yourAzureTenantID'
$loggingClientID = 'AzureADLoggingAppClientID'
$loggingSecret = 'AzureADLoggingAppClientSecret'
$logAnalyticsWorkspace = 'yourLogAnalyticsWorkspaceID'
$customLogName = "ourAppCustomLogs_CL"
# Get Access Token for Log Analytics to allow KQL Queries to get last ingested events in Custom Logs
$loginURL = "https://login.microsoftonline.com/$TenantId/oauth2/token"
$resource = "https://api.loganalytics.io"
$authbody = @{grant_type = "client_credentials"; resource = $resource; client_id = $loggingClientID; client_secret = $loggingSecret }
View UniversalDashboard-StockchartExample.ps1
import-module UniversalDashboard.Community
import-Module UniversalDashboard.UDFinancialChart
Get-UDDashboard | Stop-UDDashboard
$Theme = New-UDTheme -Name "darrenjrobinson" -Definition @{
'.dropdown-content' = @{
'min-width' = '450px'
}
'.btn-floating' = @{
View SailPoint IdentityNow Email Templates Configuration Report.ps1
# Document IdentityNow Email Templates Configuration
import-module SailPointIdentityNow
Get-IdentityNowOrg
Set-IdentityNowOrg -orgName 'yourOrgName'
$orgName = (Get-IdentityNowOrg).'Organisation Name'
$utime = [int][double]::Parse((Get-Date -UFormat %s))
# Get All Notification Templates
$getEmailTemplate = Invoke-IdentityNowRequest -uri "https://$($orgName).api.identitynow.com/cc/api/emailTemplate/list?_dc=$($utime)&filter=%7Bproperty%3A%20%22name%22%2C%20operation%3A%20%22EQ%22%2C%20value%3A%22Pending%20Access%20Request%20Cancelled%22%7D" -method get -headers Headersv3_JSON
You can’t perform that action at this time.