From 79dc1f23e26e9fd47052ee2de95b7b1c188afaf3 Mon Sep 17 00:00:00 2001 From: Victor Silva Date: Mon, 8 Oct 2018 17:31:07 -0300 Subject: [PATCH] add snippet: Exchange Online connection --- docs/community_snippets.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/community_snippets.md b/docs/community_snippets.md index ea0622d15a..c18cc6d32f 100644 --- a/docs/community_snippets.md +++ b/docs/community_snippets.md @@ -24,6 +24,7 @@ _To contribute, check out our [guide here](#contributing)._ | [DataTable](#datatable) | _Creates a DataTable_ | | [DateTimeWriteVerbose](#datetimewriteverbose) | _Write-Verbose with the time and date pre-pended to your message by @ThmsRynr_ | | [Error-Terminating](#error-terminating) | _Create a full terminating error by @omniomi_ | +| [Exchange Online Connection](exchange-online-connection) | _Create a connection to Exchange Online by @vmsilvamolina_ | | [IfShouldProcess](#ifshouldprocess) | _Added If Should Process_ | | [MaxColumnLengthinDataTable](#maxcolumnlengthindatatable) | _Gets the max length of string columns in datatables_ | | [New Azure Resource Group](#new-azure-resource-group) | _Create an Azure Resource group by @vmsilvamolina_ | @@ -177,6 +178,28 @@ Quickly add a fully defined error record and throw. by @omniomi } ``` +### Exchange Online Connection + +Connect to Exchange Online, by @vmsilvamolina + +#### Snippet + +```json +"Exchange Online Connection": { + "prefix": "ex-ExchangeOnlineConnection", + "body": [ + "#Set Execution Policy", + "Set-ExecutionPolicy RemoteSigned -Scope Process", + "#Define credential", + "\\$UserCredential = Get-Credential", + "# Create the session", + "\\$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential \\$UserCredential -Authentication Basic -AllowRedirection", + "Import-PSSession \\$Session -DisableNameChecking" + ], + "description": "Connect to Exchange Online" +} +``` + ### IfShouldProcess Add If Should Process with easy tab inputs