Last active
August 27, 2019 01:39
-
-
Save darrenjrobinson/c2cb232ce286ff3101aa61c8eae91d48 to your computer and use it in GitHub Desktop.
ChatOps for Microsoft Identity Manager - Teams Configuration and Start Script. https://blog.darrenjrobinson.com/chatops-for-microsoft-identity-manager/
This file contains 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
# Install Poshbot PowerShell Module if it doesn't already exist | |
if (-not (Get-Module -Name "Poshbot")) { | |
install-module Poshbot | |
} | |
# Install LithnetRMA PowerShell Module if it doesn't already exist | |
if (-not (Get-Module -Name "LithnetRMA")) { | |
install-module LithnetRMA | |
} | |
# Install LithnetMIISAutomation PowerShell Module if it doesn't already exist | |
# The following module is required on your MIM Sync Server. Execute the following there and enable Remote PowerShell. | |
# See https://blog.darrenjrobinson.com/remotely-managing-your-fimmim-synchronisation-server-using-powershell-and-the-lithnet-miis-automation-powershell-module/ | |
#if (-not (Get-Module -Name "LithnetMIISAutomation")) { | |
# install-module LithnetMIISAutomation | |
#} | |
# Check to see if the Lithnet PostBot RMA Module has been installed | |
if (-not (Get-Module -Name "PoshBot.LithnetRMA")) { | |
install-module "PoshBot.LithnetRMA" | |
} | |
# Check to see if the Lithnet PostBot MIIS Automation Module has been installed | |
if (-not (Get-Module -Name "Poshbot.LithnetMiisAutomation")) { | |
install-module "Poshbot.LithnetMiisAutomation" | |
} | |
Import-Module PoshBot | |
$pbc = New-PoshBotConfiguration | |
$pbc.BotAdmins = @('MIMGuy@mydomain.com.au') | |
$pbc.AlternateCommandPrefixes = @('lithnet') | |
$pbc.PluginConfiguration = @{ | |
'PoshBot.LithnetRMA' = @{ | |
MIMServiceCreds = import-clixml C:\poshbot\MIMAdminSyncCred.xml | |
MIMServiceAddress = 'http://mimserviceserver:5725' | |
} | |
'PoshBot.LithnetMIISAutomation' = @{ | |
MIMSyncCreds = import-clixml C:\Scripts\poshbot\poshbot\MIMAdminSyncCred.xml | |
MIMSyncAddress = 'mimsyncserver.yourdomain.com' #Must be FQDN | |
} | |
} | |
$PoshbotPath = 'C:\poshbot' | |
$PoshbotConfig = Join-Path $PoshbotPath config.psd1 | |
$PoshbotPlugins = Join-Path $PoshbotPath plugins | |
$PoshbotLogs = Join-Path $PoshbotPath logs | |
$backendConfig = @{ | |
Name = 'TeamsPoshBotBackend' | |
BotName = 'IdentityBot' | |
TeamId = '19:162a04c26def41dea1234567890@thread.skype' | |
ServiceBusNamespace = 'identitybotsb' | |
QueueName = 'messages' | |
AccessKeyName = 'receive' | |
AccessKey = '0a+8ElzKS9F1/iieCZpRC3RtAEBboh0hABCDEFG=' | ConvertTo-SecureString -AsPlainText -Force | |
Credential = [pscredential]::new('f2b1a38f-0622-4eab-a502-1234567890',('j3*FtBRr4-OR0R/I2oMxd-[ABCDEFG' | ConvertTo-SecureString -AsPlainText -Force) | |
) | |
ConfigurationDirectory = $PoshbotPath | |
LogDirectory = $PoshbotLogs | |
PluginDirectory = $PoshbotPlugins | |
} | |
$backend = New-PoshBotTeamsBackend -Configuration $backendConfig | |
$bot = New-PoshBotInstance -Configuration $pbc -Backend $backend | |
$bot | Start-PoshBot -Debug -Verbose | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment