This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using namespace System.Net | |
| # Input bindings are passed in via param block. | |
| param($Request, $TriggerMetadata) | |
| # Write to the Azure Functions log stream. | |
| Write-Host "PowerShell HTTP trigger function processed a request." | |
| $inputData = $Request.Body | convertfrom-json | |
| $emailSubject = $inputData.subject |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $mail = @{ | |
| "personalizations" = @( | |
| @{ | |
| "to" = @( | |
| @{ | |
| "email" = "$($env:sendGridToAddress)" | |
| } | |
| ) | |
| } | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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' |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' ` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $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 } |