Forum Discussion

MarkLakatos's avatar
MarkLakatos
Copper Contributor
Jul 08, 2024

Problem deploying Microsoft 365 DSC configuration

Hello all!

I have been workin on a little demo on Microsoft 365 DSC and i have been running into the same problem while trying to deploy a configuration. So basically i want to make a new 365 Group with code, (see below) and this is the error i always get. (2 pictures) I think i am connected to Connect-MgGraph, is says it also.

The configuration code: 

Configuration CreateO365Group
{   
    
    param(
        [Parameter(Mandatory = $true)]
        [PSCredential]
        $Credential
    )
  if ($null -eq $Credential)
    {
        <# Credentials #>
        $Credscredential = Get-Credential -Message "Credentials"
 
    }
    else
    {
        $CredsCredential = $Credential
    }
 
    $OrganizationName = $CredsCredential.UserName.Split('@')[1]
 
   Import-DscResource -ModuleName Microsoft365DSC -ModuleVersion '1.24.626.1'
 
    
    Node localhost
    {
        O365Group '1234'
        {
           Credential = $Credscredential
           DisplayName = "Tesztelt feltoltes12"
           MailNickName = "EmployeesHello1234"
           Description = "Feltoltes1234"
           ManagedBy = @("enokgabor@$OrganizationName")
           Members = @()
           Ensure = "Present"
        }
    }
}
 
 
CreateO365Group -ConfigurationData C:\demoUse\ConfigurationData.psd1 -Credential $Credscredential
 
The Powershell messages: 
No RepliesBe the first to reply

Resources