Announcements
Hi, I am looking for Microsoft guidance on what PowerShell commands to use in absence of MSOnline to configure the following: https://learn.microsoft.com/en-us/dynamics365/customerengagement/on-premises/admin/on-prem-server-based-sharepoint-online?view=op-9-0
I have managed to get past some with MGGraph but am failing on others, we really need this updated if they are going to deprecate the MSOnline.
Many thanks,
$RootDomain = “*.Thisdomainbeingourcustomerfacingurl”
$CRMAppId = "00000007-0000-0000-c000-000000000000"
New-MsolServicePrincipalCredential -AppPrincipalId $CRMAppId -Type asymmetric -Usage Verify -Value $CredentialValue
$CRM = Get-MsolServicePrincipal -AppPrincipalId $CRMAppId
$ServicePrincipalName = $CRM.ServicePrincipalNames
$ServicePrincipalName.Remove("$CRMAppId/$RootDomain")
$ServicePrincipalName.Add("$CRMAppId/$RootDomain")
Set-MsolServicePrincipal -AppPrincipalId $CRMAppId -ServicePrincipalNames $ServicePrincipalName
# Connect to Microsoft Graph
Connect-MgGraph -Scopes "Sites.FullControl.All", "Application.ReadWrite.All"# Create Azure AD Application
$App = New-MgApplication -DisplayName "Dynamics365-SharePointIntegration" -SignInAudience "AzureADMyOrg"# Create Service Principal
$ServicePrincipal = New-MgServicePrincipal -AppId $App.AppId# Create Client Secret
$Password = New-MgApplicationPassword -ApplicationId $App.Id# Grant SharePoint Online Permissions
$SharePointAppRoleId = "Your_SharePoint_AppRoleId" # Find the correct appRoleId
New-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $ServicePrincipal.Id -AppRoleId $SharePointAppRoleId -ResourceId "00000003-0000-0ff1-ce00-000000000000"
You're absolutely right. The deprecation of the MSOnline module necessitates a shift to Microsoft Graph PowerShell for managing Dynamics 365 (on-premises) with SharePoint Online integration. The Microsoft documentation you linked is outdated in this regard.
Here's a breakdown of how to translate the MSOnline commands to Microsoft Graph PowerShell, along with explanations and potential pitfalls:
Key Concepts and Challenges:
Translating MSOnline Commands to Microsoft Graph PowerShell:
New-MgApplication
: Create a new application registration.New-MgServicePrincipal
: Create a service principal for the application.New-MgApplicationPassword
: Add a client secret.New-MgServicePrincipalAppRoleAssignment
: assign api permissions.New-MgServicePrincipalAppRoleAssignment
: Use this to grant SharePoint Online permissions.appRoleId
for the SharePoint Online permissions you need (e.g., Sites.FullControl.All
).Important Considerations:
Connect-MgGraph
and provide the TenantId
, ClientId
, and ClientSecret.
try...catch
blocks to catch and handle exceptions.Sites.FullControl.All
, but depending on your needs, you may need others.Example (Conceptual):
Key Recommendations:
By following these guidelines, you can successfully configure Dynamics 365 (on-premises) with SharePoint Online integration using Microsoft Graph PowerShell.
André Arnaud de Cal...
294,125
Super User 2025 Season 1
Martin Dráb
232,871
Most Valuable Professional
nmaenpaa
101,158
Moderator