Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

Dependencies on beta MS graph

Open jagatjb opened this issue 2 years ago • 8 comments

Why is there a dependency on Microsoft.Graph.Beta modules for M365 DSC ? Isn't Microsoft.Graph should be enough ?

One more question, lets say a module is released which has dependency on version 2.15 of Microsoft Graph. But i have 2.16 version installed. Will it work then ? What will happen if I run the update dependencies cmdlet ?

jagatjb avatar Apr 04 '24 08:04 jagatjb

Looks like dependencies will at least be updated soonish but yeah, mixing and matching is problematic. if you for example use the Microsoft.Graph.Sites Module module in 2.16 and run the Uninstall-M365DSCOutdatedDependencies it will kill dependencies for the module since it relies on the Microsoft.Graph.Authentication being the same version (2.16) where as M365DSC uses 2.15.

ssoabx avatar Apr 04 '24 08:04 ssoabx

Looks like dependencies will at least be updated soonish but yeah, mixing and matching is problematic. if you for example use the Microsoft.Graph.Sites Module module in 2.16 and run the Uninstall-M365DSCOutdatedDependencies it will kill dependencies for the module since it relies on the Microsoft.Graph.Authentication being the same version (2.16) where as M365DSC uses 2.15.

Yeah, it should work on the newer releases as we do have other scripts running which are dependent on latest graph versions. And as a result, the scripts breaks.

jagatjb avatar Apr 04 '24 10:04 jagatjb

@NikCharlebois @ykuijs @andikrueger can you please assist here.

jagatjb avatar Apr 08 '24 14:04 jagatjb

Hi @jagatjb, some of the settings that we want to manage are not (yet) available in the v1.0 version of the Graph API, but are in the Beta version. That is why we are using the Beta modules. As soon as the settings are also available in the released API, we can switch to the normal version of the modules. However that is something we currently do not automatically detect. So if you see there are scenarios where the Beta module can be replaced by the v1 version, please let us know.

Regarding your second question: We have seen instances in the past where different versions of the modules were causing conflicts. That is why we have created two cmdlets:

  1. Update-M365DSCDependencies: This installs all the correct version of all required modules.
  2. Uninstall-M365DSCOutdatedDependencies: This removes all versions of the required modules, with the exception of the required version.

So if you run the first cmdlet, v2.15 will be installed but v2.16 will be left untouched. As soon as you run the second cmdlet, the v2.16 will be deleted, making sure v2.15 is the only installed version.

ykuijs avatar Apr 09 '24 11:04 ykuijs

Hi @jagatjb, some of the settings that we want to manage are not (yet) available in the v1.0 version of the Graph API, but are in the Beta version. That is why we are using the Beta modules. As soon as the settings are also available in the released API, we can switch to the normal version of the modules. However that is something we currently do not automatically detect. So if you see there are scenarios where the Beta module can be replaced by the v1 version, please let us know.

Regarding your second question: We have seen instances in the past where different versions of the modules were causing conflicts. That is why we have created two cmdlets:

  1. Update-M365DSCDependencies: This installs all the correct version of all required modules.
  2. Uninstall-M365DSCOutdatedDependencies: This removes all versions of the required modules, with the exception of the required version.

So if you run the first cmdlet, v2.15 will be installed but v2.16 will be left untouched. As soon as you run the second cmdlet, the v2.16 will be deleted, making sure v2.15 is the only installed version.

Thanks a lot for your input here. I have another question regarding this.

Lets say I already have v2.16 installed in my server and it is being used to run some scripts. Now I install the M365 DSC module which has the dependency of v2.15. In this case, the v2.15 will get installed and then the M365 DSC module cmdlets will not run as there is a conflict which can be managed by Uninstall-M365DSCOutdatedDependencies. Since v2.16 is the latest one, don't you think it should detect and use the latest graph module instead of installing the previous version of graph, ie. v2.15 ?

So in such cases, the other scripts which are already using v2.16 should be left untouched.

jagatjb avatar Apr 09 '24 12:04 jagatjb

@jagatjb Using other modules than the ones specified in the M365DSC manifest might cause issues because there could be parameter and other functional changes that are not yet reflected in the module and would cause the whole thing to break down. In my opinion, sticking to the specified version is the way to go, since troubleshooting changes from a module version higher than the ones we tested and evaluated against can be very time consuming.

FabienTschanz avatar Apr 19 '24 12:04 FabienTschanz

I would highly recommend to run Microsoft 365 DSC on a system that is not used by other modules. Putting the security risks aside ( e.g. existing certificates for service principals) we have seen issues with other modules in the paste that might export cmdLets with names that conflict with either M365DSC or its dependencies. In that case you also not need to worry about the version issues with other modules.

andikrueger avatar Apr 19 '24 12:04 andikrueger

I would highly recommend to run Microsoft 365 DSC on a system that is not used by other modules. Putting the security risks aside ( e.g. existing certificates for service principals) we have seen issues with other modules in the paste that might export cmdLets with names that conflict with either M365DSC or its dependencies. In that case you also not need to worry about the version issues with other modules.

Will do this only. Build a separate server for M365 DSC module. This should be the best approach. I will close this thread. Thanks everyone for your inputs.

jagatjb avatar Apr 19 '24 12:04 jagatjb