Reputation: 11
I am following documentation https://learn.microsoft.com/en-us/azure/active-directory/b2b/direct-federation on Powershell and running below command:
Import-Module AzureAD
Connect-AzureAD
$federationSettings = New-Object Microsoft.Open.AzureAD.Model.DomainFederationSettings
I am getting following error:
PS C:\WINDOWS\system32> $federationSettings = New-Object Microsoft.Open.AzureAD.Model.DomainFederationSettings
New-Object : Cannot find type [Microsoft.Open.AzureAD.Model.DomainFederationSettings]: verify that the assembly
containing this type is loaded.
At line:1 char:23
+ ... nSettings = New-Object Microsoft.Open.AzureAD.Model.DomainFederationS ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
DomainFederationSettings class seems to be missing
How can I have Microsoft.Open.AzureAD.Model.DomainFederationSettings loaded and execute command $federationSettings = New-Object Microsoft.Open.AzureAD.Model.DomainFederationSettings
Upvotes: 1
Views: 4564
Reputation: 10333
at the time of writing this answer, you need to use AzureADPreview module and not AzureAd
I highly suspect you are trying this statement with the latter rather than the former.
To install
Install-Module -Name AzureADPreview -AllowClobber
(-AllowClobber
is to allow the installation side-to-side with AzureAD module, if you have it installed)
To configure direct federation in Azure AD using PowerShell
Install the latest version of the Azure AD PowerShell for Graph module (AzureADPreview). (If you need detailed steps, the quickstart for adding a guest user includes the section Install the latest AzureADPreview module.)
Source :
MS docs - Configure direct federation in azure ad using powershell
Upvotes: 2