Skip to content
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

Export-M365DSCConfiguration: "Organization cannot be a Guid, please enter the name of the tenant instead." when exporting SC config #3046

Closed
jeremyhagan opened this issue Mar 20, 2023 · 3 comments · Fixed by #3137
Assignees
Labels
Core Engine Enhancement New feature or request

Comments

@jeremyhagan
Copy link

Details of the scenario you tried and the problem that is occurring

Use https://export.microsoft365dsc.com/ to generate the command to export from Security and Compliance Centre and Exchange
Select Cetrificate as the authentication method.
Run the command with an appropriate TenantId, AppId and Cert thumbprint.

Verbose logs showing the problem

VERBOSE: Dependencies were already successfully validated.
VERBOSE: ApplicationId, TenantId, CertificateThumbprint were specified. Connecting via Service Principal
Connecting to {ExchangeOnline}...VERBOSE: Returning precomputed version info: 3.1.0
VERBOSE: POST https://outlook.office365.com/adminapi/beta/bd13c3bf-aa4a-4fb4-a11c-fcf976c42a1d/InvokeCommand with -1-byte payload
VERBOSE: received 1306-byte response of content type application/json;charset=utf-8

Connecting to {SecurityComplianceCenter}...VERBOSE: Returning precomputed version info: 3.1.0
VERBOSE: ModuleVersion: 3.1.0
VERBOSE: ConnectionContext Removed

Organization cannot be a Guid, please enter the name of the tenant instead.

Suggested solution to the issue

The DSC configuration that is used to reproduce the issue (as detailed as possible)

# Getting application information for Application + Certificate authentication
$ApplicationId = "<GUID>"
$CertificateThumbprint = "<thumbprint>"
$TenantId = "<GUID>"

# Exporting resources using certificate
Export-M365DSCConfiguration -Components @("EXOAntiPhishPolicy", 
    "EXOAntiPhishRule", 
    "EXOAtpPolicyForO365", 
    "EXOHostedContentFilterPolicy", 
    "EXOHostedContentFilterRule", 
    "EXOHostedOutboundSpamFilterPolicy", 
    "EXOHostedOutboundSpamFilterRule", 
    "EXOMalwareFilterPolicy", 
    "EXOMalwareFilterRule", 
    "EXOSafeAttachmentPolicy", 
    "EXOSafeAttachmentRule", 
    "EXOSafeLinksPolicy", 
    "EXOSafeLinksRule", 
    "EXOTransportRule", 
    "SCAutoSensitivityLabelPolicy", 
    "SCAutoSensitivityLabelRule", 
    "SCDLPCompliancePolicy", 
    "SCDLPComplianceRule",
    "SCLabelPolicy", 
    "SCSensitivityLabel") -ApplicationId $ApplicationId -CertificateThumbprint $CertificateThumbprint -TenantId $TenantId

The operating system the target node is running

OsName : Microsoft Windows 10 Pro
OsOperatingSystemSKU : 48
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage : en-US
OsMuiLanguages : {en-US}

Version of the DSC module that was used ('dev' if using current dev branch)

1.23.315.1

@ykuijs
Copy link
Member

ykuijs commented Mar 21, 2023

Please specify your tenant name (tenant.onmicrosoft.com) for $TenantId instead of your tenant GUID. That should work as expected.

@andikrueger
Copy link
Collaborator

@ykuijs Could we add a ValidateScript for the parameter:

[ValidateScript({
            try {
                [System.Guid]::Parse($_) | Out-Null
                $false
            } catch {
                $true
            }
        })]
[String]
$TenantId

@NikCharlebois
Copy link
Collaborator

Agreed that we should provide validation. PR is on its way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Engine Enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants