-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added M365 connections to shared #2090
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting changes as there are a few things that should be changed (see comments).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address all open comments then let me know when this is ready for the next review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be some more things that I find later on, but here is a good starting point to address.
We should also look into adding pester testing here as well. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost ready to go, after we get the next commit, let's also rebase this down to a single commit.
[Parameter(Mandatory = $false)] | ||
[System.Version]$MinModuleVersion = $null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we did address this by being in a loop, but the chances of you having a module that you are requesting be at the same min version is pretty low.
Shared/ModuleHandle.ps1
Outdated
} | ||
$installed = Get-InstalledModule @getParams | ||
|
||
if ($null -eq $installed -or $installed.Name -notcontains $module) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we did find the module with the version that we are looking for, we should do Write-Verbose
here that states at least the version to know if it is something newer and possibly something changed with the cmdlets that broke something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iserrano76 let's do this and rebase and then we should be good for one last review before merge.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Shared/ModuleHandle.ps1
Outdated
@@ -29,19 +29,18 @@ function Request-Module { | |||
[OutputType([bool])] | |||
param ( | |||
[Parameter(Mandatory = $true)] | |||
[string[]]$Modules, | |||
[string[]]$Module, | |||
[Parameter(Mandatory = $false)] | |||
[System.Version]$MinModuleVersion = $null | |||
) | |||
|
|||
$noFoundError = $true | |||
foreach ($module in $Modules) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You broke this loop because you changed the parameter name to be $Module
instead of $Modules
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for point to this, I am modifying the parameter to singular as you recommend in a previous PR from the Development Guidelines.
I will fix this and rebase
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@iserrano76 let's go ahead and rebase and squash this down to a single commit. |
Issue:
Added two functions to Shared in case any script needs a connection to M365.
One function for Exchange Online another function for AzureAD
Reason:
Unify the way we connect to M365.
Fix:
Both functions will do the following:
Important: we do not disconnect at anytime we just verify if we have an active session