Release 1.24.605.1
This commit is contained in:
Родитель
27102588fa
Коммит
81d4ea346a
|
@ -1,13 +1,18 @@
|
|||
# Change log for Microsoft365DSC
|
||||
|
||||
# UNRELEASED
|
||||
# 1.24.605.1
|
||||
|
||||
* AADAuthenticationFlowPolicy
|
||||
* Initial Release.
|
||||
* AADEntitlementManagementRoleAssignment
|
||||
* Initial Release.
|
||||
* M365DSCResourceGenerator
|
||||
* Add support for generating Intune settings catalog policies
|
||||
* M365DSCDRGUtil
|
||||
* Add multiple commands for Intune policies that use the settings catalog
|
||||
* DEPENDENCIES
|
||||
* Updated MSCloudLoginAssistant to version 1.1.17.
|
||||
* Updated ReverseDSC to version 2.0.0.20.
|
||||
|
||||
# 1.24.529.1
|
||||
|
||||
|
|
|
@ -0,0 +1,382 @@
|
|||
function Get-TargetResource
|
||||
{
|
||||
[CmdletBinding()]
|
||||
[OutputType([System.Collections.Hashtable])]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[System.String]
|
||||
$IsSingleInstance,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$Id,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$DisplayName,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$Description,
|
||||
|
||||
[Parameter()]
|
||||
[System.Boolean]
|
||||
$SelfServiceSignUpEnabled,
|
||||
|
||||
[Parameter()]
|
||||
[System.Management.Automation.PSCredential]
|
||||
$Credential,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$ApplicationId,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$TenantId,
|
||||
|
||||
[Parameter()]
|
||||
[System.Management.Automation.PSCredential]
|
||||
$ApplicationSecret,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$CertificateThumbprint,
|
||||
|
||||
[Parameter()]
|
||||
[Switch]
|
||||
$ManagedIdentity,
|
||||
|
||||
[Parameter()]
|
||||
[System.String[]]
|
||||
$AccessTokens
|
||||
)
|
||||
|
||||
Write-Verbose -Message 'Getting configuration of Authentication Flow Policy'
|
||||
$ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' `
|
||||
-InboundParameters $PSBoundParameters
|
||||
|
||||
#Ensure the proper dependencies are installed in the current environment.
|
||||
Confirm-M365DSCDependencies
|
||||
|
||||
#region Telemetry
|
||||
$ResourceName = $MyInvocation.MyCommand.ModuleName -replace 'MSFT_', ''
|
||||
$CommandName = $MyInvocation.MyCommand
|
||||
$data = Format-M365DSCTelemetryParameters -ResourceName $ResourceName `
|
||||
-CommandName $CommandName `
|
||||
-Parameters $PSBoundParameters
|
||||
Add-M365DSCTelemetryEvent -Data $data
|
||||
#endregion
|
||||
|
||||
$nullReturn = @{
|
||||
IsSingleInstance = 'Yes'
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$flowPolicy = Get-MgBetaPolicyAuthenticationFlowPolicy -ErrorAction 'SilentlyContinue'
|
||||
|
||||
if ($null -eq $flowPolicy)
|
||||
{
|
||||
throw 'Could not retrieve Authentication Flow Policy'
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Verbose -Message 'Found existing Authentication Flow Policy'
|
||||
$result = @{
|
||||
IsSingleInstance = 'Yes'
|
||||
Id = $flowPolicy.Id
|
||||
DisplayName = $flowPolicy.DisplayName
|
||||
Description = $flowPolicy.Description
|
||||
SelfServiceSignUpEnabled = [Boolean]$flowPolicy.SelfServiceSignUp.IsEnabled
|
||||
Credential = $Credential
|
||||
ApplicationId = $ApplicationId
|
||||
TenantId = $TenantId
|
||||
ApplicationSecret = $ApplicationSecret
|
||||
CertificateThumbprint = $CertificateThumbprint
|
||||
Managedidentity = $ManagedIdentity.IsPresent
|
||||
AccessTokens = $AccessTokens
|
||||
}
|
||||
Write-Verbose -Message "Get-TargetResource Result: `n $(Convert-M365DscHashtableToString -Hashtable $result)"
|
||||
return $result
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
New-M365DSCLogEntry -Message 'Error retrieving data:' `
|
||||
-Exception $_ `
|
||||
-Source $($MyInvocation.MyCommand.Source) `
|
||||
-TenantId $TenantId `
|
||||
-Credential $Credential
|
||||
|
||||
return $nullReturn
|
||||
}
|
||||
}
|
||||
|
||||
function Set-TargetResource
|
||||
{
|
||||
[CmdletBinding()]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[System.String]
|
||||
$IsSingleInstance,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$Id,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$DisplayName,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$Description,
|
||||
|
||||
[Parameter()]
|
||||
[System.Boolean]
|
||||
$SelfServiceSignUpEnabled,
|
||||
|
||||
[Parameter()]
|
||||
[System.Management.Automation.PSCredential]
|
||||
$Credential,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$ApplicationId,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$TenantId,
|
||||
|
||||
[Parameter()]
|
||||
[System.Management.Automation.PSCredential]
|
||||
$ApplicationSecret,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$CertificateThumbprint,
|
||||
|
||||
[Parameter()]
|
||||
[Switch]
|
||||
$ManagedIdentity,
|
||||
|
||||
[Parameter()]
|
||||
[System.String[]]
|
||||
$AccessTokens
|
||||
)
|
||||
|
||||
Write-Verbose -Message 'Setting configuration of Authentication flow policy.'
|
||||
$ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' `
|
||||
-InboundParameters $PSBoundParameters
|
||||
|
||||
#Ensure the proper dependencies are installed in the current environment.
|
||||
Confirm-M365DSCDependencies
|
||||
|
||||
#region Telemetry
|
||||
$ResourceName = $MyInvocation.MyCommand.ModuleName -replace 'MSFT_', ''
|
||||
$CommandName = $MyInvocation.MyCommand
|
||||
$data = Format-M365DSCTelemetryParameters -ResourceName $ResourceName `
|
||||
-CommandName $CommandName `
|
||||
-Parameters $PSBoundParameters
|
||||
Add-M365DSCTelemetryEvent -Data $data
|
||||
#endregion
|
||||
|
||||
try
|
||||
{
|
||||
Update-MgBetaPolicyAuthenticationFlowPolicy -SelfServiceSignUp $SelfServiceSignUpEnabled | Out-Null
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Verbose -Message 'Cannot update the authentication flow policy.'
|
||||
}
|
||||
}
|
||||
|
||||
function Test-TargetResource
|
||||
{
|
||||
[CmdletBinding()]
|
||||
[OutputType([System.Boolean])]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[System.String]
|
||||
$IsSingleInstance,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$Id,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$DisplayName,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$Description,
|
||||
|
||||
[Parameter()]
|
||||
[System.Boolean]
|
||||
$SelfServiceSignUpEnabled,
|
||||
|
||||
[Parameter()]
|
||||
[System.Management.Automation.PSCredential]
|
||||
$Credential,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$ApplicationId,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$TenantId,
|
||||
|
||||
[Parameter()]
|
||||
[System.Management.Automation.PSCredential]
|
||||
$ApplicationSecret,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$CertificateThumbprint,
|
||||
|
||||
[Parameter()]
|
||||
[Switch]
|
||||
$ManagedIdentity,
|
||||
|
||||
[Parameter()]
|
||||
[System.String[]]
|
||||
$AccessTokens
|
||||
)
|
||||
|
||||
#Ensure the proper dependencies are installed in the current environment.
|
||||
Confirm-M365DSCDependencies
|
||||
|
||||
#region Telemetry
|
||||
$ResourceName = $MyInvocation.MyCommand.ModuleName -replace 'MSFT_', ''
|
||||
$CommandName = $MyInvocation.MyCommand
|
||||
$data = Format-M365DSCTelemetryParameters -ResourceName $ResourceName `
|
||||
-CommandName $CommandName `
|
||||
-Parameters $PSBoundParameters
|
||||
Add-M365DSCTelemetryEvent -Data $data
|
||||
#endregion
|
||||
|
||||
Write-Verbose -Message 'Testing configuration of Authentication Flow Policy'
|
||||
|
||||
$CurrentValues = Get-TargetResource @PSBoundParameters
|
||||
|
||||
Write-Verbose -Message "Current Values: $(Convert-M365DscHashtableToString -Hashtable $CurrentValues)"
|
||||
Write-Verbose -Message "Target Values: $(Convert-M365DscHashtableToString -Hashtable $PSBoundParameters)"
|
||||
|
||||
$ValuesToCheck = $PSBoundParameters
|
||||
|
||||
$TestResult = Test-M365DSCParameterState -CurrentValues $CurrentValues `
|
||||
-Source $($MyInvocation.MyCommand.Source) `
|
||||
-DesiredValues $PSBoundParameters `
|
||||
-ValuesToCheck $ValuesToCheck.Keys
|
||||
|
||||
Write-Verbose -Message "Test-TargetResource returned $TestResult"
|
||||
|
||||
return $TestResult
|
||||
}
|
||||
|
||||
function Export-TargetResource
|
||||
{
|
||||
[CmdletBinding()]
|
||||
[OutputType([System.String])]
|
||||
param
|
||||
(
|
||||
[Parameter()]
|
||||
[System.Management.Automation.PSCredential]
|
||||
$Credential,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$ApplicationId,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$TenantId,
|
||||
|
||||
[Parameter()]
|
||||
[System.Management.Automation.PSCredential]
|
||||
$ApplicationSecret,
|
||||
|
||||
[Parameter()]
|
||||
[System.String]
|
||||
$CertificateThumbprint,
|
||||
|
||||
[Parameter()]
|
||||
[Switch]
|
||||
$ManagedIdentity,
|
||||
|
||||
[Parameter()]
|
||||
[System.String[]]
|
||||
$AccessTokens
|
||||
)
|
||||
$ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' `
|
||||
-InboundParameters $PSBoundParameters
|
||||
|
||||
#Ensure the proper dependencies are installed in the current environment.
|
||||
Confirm-M365DSCDependencies
|
||||
|
||||
#region Telemetry
|
||||
$ResourceName = $MyInvocation.MyCommand.ModuleName -replace 'MSFT_', ''
|
||||
$CommandName = $MyInvocation.MyCommand
|
||||
$data = Format-M365DSCTelemetryParameters -ResourceName $ResourceName `
|
||||
-CommandName $CommandName `
|
||||
-Parameters $PSBoundParameters
|
||||
Add-M365DSCTelemetryEvent -Data $data
|
||||
#endregion
|
||||
|
||||
$dscContent = ''
|
||||
try
|
||||
{
|
||||
$Params = @{
|
||||
IsSingleInstance = 'Yes'
|
||||
Credential = $Credential
|
||||
ApplicationId = $ApplicationId
|
||||
ApplicationSecret = $ApplicationSecret
|
||||
TenantId = $TenantId
|
||||
CertificateThumbprint = $CertificateThumbprint
|
||||
ManagedIdentity = $ManagedIdentity.IsPresent
|
||||
AccessTokens = $AccessTokens
|
||||
}
|
||||
$Results = Get-TargetResource @Params
|
||||
|
||||
if ($Results -is [System.Collections.Hashtable] -and $Results.Count -gt 1)
|
||||
{
|
||||
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode -Results $Results
|
||||
$currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName -ConnectionMode $ConnectionMode `
|
||||
-ModulePath $PSScriptRoot `
|
||||
-Results $Results `
|
||||
-Credential $Credential
|
||||
$dscContent += $currentDSCBlock
|
||||
|
||||
Save-M365DSCPartialExport -Content $currentDSCBlock `
|
||||
-FileName $Global:PartialExportFileName
|
||||
|
||||
Write-Host $Global:M365DSCEmojiGreenCheckMark
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host $Global:M365DSCEmojiRedX
|
||||
}
|
||||
|
||||
return $dscContent
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Host $Global:M365DSCEmojiRedX
|
||||
|
||||
New-M365DSCLogEntry -Message 'Error during Export:' `
|
||||
-Exception $_ `
|
||||
-Source $($MyInvocation.MyCommand.Source) `
|
||||
-TenantId $TenantId `
|
||||
-Credential $Credential
|
||||
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
Export-ModuleMember -Function *-TargetResource
|
|
@ -0,0 +1,16 @@
|
|||
[ClassVersion("1.0.0.0"), FriendlyName("AADAuthenticationFlowPolicy")]
|
||||
class MSFT_AADAuthenticationFlowPolicy : OMI_BaseResource
|
||||
{
|
||||
[Key, Description("Only valid value is 'Yes'."), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance;
|
||||
[Write, Description("Unique identifier of the Authentication Flow Policy.")] String Id;
|
||||
[Write, Description("Display name of the Authentication Flow Policy.")] String DisplayName;
|
||||
[Write, Description("Description of the Authentication Flow Policy.")] String Description;
|
||||
[Write, Description("Indicates whether self-service sign-up flow is enabled or disabled. The default value is false. This property isn't a key. Required.")] String SelfServiceSignUpEnabled;
|
||||
[Write, Description("Credentials of the Azure Active Directory Admin"), EmbeddedInstance("MSFT_Credential")] string Credential;
|
||||
[Write, Description("Id of the Azure Active Directory application to authenticate with.")] String ApplicationId;
|
||||
[Write, Description("Id of the Azure Active Directory tenant used for authentication.")] String TenantId;
|
||||
[Write, Description("Secret of the Azure Active Directory application to authenticate with."), EmbeddedInstance("MSFT_Credential")] String ApplicationSecret;
|
||||
[Write, Description("Thumbprint of the Azure Active Directory application's authentication certificate to use for authentication.")] String CertificateThumbprint;
|
||||
[Write, Description("Managed ID being used for authentication.")] Boolean ManagedIdentity;
|
||||
[Write, Description("Access token used for authentication.")] String AccessTokens[];
|
||||
};
|
|
@ -0,0 +1,5 @@
|
|||
# AADAuthenticationFlowPolicy
|
||||
|
||||
## Description
|
||||
|
||||
Represents the policy configuration of self-service sign-up experience at a tenant level that lets external users request to sign up for approval. It contains information, such as the identifier, display name, and description, and indicates whether self-service sign-up is enabled for the policy.
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"resourceName": "AADAuthenticationFlowPolicy",
|
||||
"description": "Represents the policy configuration of self-service sign-up experience at a tenant level that lets external users request to sign up for approval. It contains information, such as the identifier, display name, and description, and indicates whether self-service sign-up is enabled for the policy.",
|
||||
"roles": {
|
||||
"read": [
|
||||
"Security Reader"
|
||||
],
|
||||
"update": [
|
||||
"Authentication Policy Administrator"
|
||||
]
|
||||
},
|
||||
"permissions": {
|
||||
"graph": {
|
||||
"delegated": {},
|
||||
"application": {
|
||||
"read": [
|
||||
{
|
||||
"name": "Policy.Read.All"
|
||||
}
|
||||
],
|
||||
"update": [
|
||||
{
|
||||
"name": "Policy.ReadWrite.AuthenticationFlows"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -90,7 +90,7 @@
|
|||
},
|
||||
@{
|
||||
ModuleName = "MSCloudLoginAssistant"
|
||||
RequiredVersion = "1.1.16"
|
||||
RequiredVersion = "1.1.17"
|
||||
},
|
||||
@{
|
||||
ModuleName = 'PnP.PowerShell'
|
||||
|
@ -98,7 +98,7 @@
|
|||
},
|
||||
@{
|
||||
ModuleName = 'ReverseDSC'
|
||||
RequiredVersion = '2.0.0.19'
|
||||
RequiredVersion = '2.0.0.20'
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<#
|
||||
This example is used to test new resources and showcase the usage of new resources being worked on.
|
||||
It is not meant to use as a production baseline.
|
||||
#>
|
||||
|
||||
Configuration Example {
|
||||
param(
|
||||
[System.Management.Automation.PSCredential]
|
||||
$credsCredential
|
||||
)
|
||||
|
||||
Import-DscResource -ModuleName Microsoft365DSC
|
||||
|
||||
Node Localhost
|
||||
{
|
||||
AADAuthenticationFlowPolicy "AADAuthenticationFlowPolicy"
|
||||
{
|
||||
Credential = $credsCredential;
|
||||
Description = "Authentication flows policy allows modification of settings related to authentication flows in AAD tenant, such as self-service sign up configuration.";
|
||||
DisplayName = "Authentication flows policy";
|
||||
Id = "authenticationFlowsPolicy";
|
||||
IsSingleInstance = "Yes";
|
||||
SelfServiceSignUpEnabled = $True;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# Generated by: Microsoft Corporation
|
||||
#
|
||||
# Generated on: 2024-05-29
|
||||
# Generated on: 2024-06-05
|
||||
|
||||
@{
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
|||
# RootModule = ''
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '1.24.529.1'
|
||||
ModuleVersion = '1.24.605.1'
|
||||
|
||||
# Supported PSEditions
|
||||
# CompatiblePSEditions = @()
|
||||
|
@ -142,30 +142,15 @@
|
|||
IconUri = 'https://github.com/microsoft/Microsoft365DSC/blob/Dev/Modules/Microsoft365DSC/Dependencies/Images/Logo.png?raw=true'
|
||||
|
||||
# ReleaseNotes of this module
|
||||
ReleaseNotes = '* AADAdministrativeUnit
|
||||
* Implemented advanced query based on
|
||||
https://learn.microsoft.com/en-us/graph/aad-advanced-queries?tabs=http#administrative-unit-properties
|
||||
* AADAuthenticationMethodPolicy
|
||||
* Add support for disabled policies
|
||||
* AADConditionalAccessPolicy
|
||||
* Fix get method if value is null instead of false
|
||||
* IntuneAppConfigurationDevicePolicy
|
||||
* Initial release
|
||||
* IntuneDeviceRemediation
|
||||
* Added support for Access Tokens
|
||||
* IntuneDiskEncryptionMacOS
|
||||
* Initial Release
|
||||
* IntuneSettingCatalogASRRulesPolicyWindows10
|
||||
* Add missing properties
|
||||
FIXES [#4713](https://github.com/microsoft/Microsoft365DSC/issues/4713)
|
||||
* O365AdminAuditLogConfig
|
||||
* Fix logging of exception if Set-AdminAuditLogConfig fails
|
||||
FIXES [#4645](https://github.com/microsoft/Microsoft365DSC/issues/4645)
|
||||
* ResourceGenerator
|
||||
* Added `AccessTokens` parameter to PS1 and MOF template
|
||||
ReleaseNotes = '* AADEntitlementManagementRoleAssignment
|
||||
* Initial Release.
|
||||
* M365DSCResourceGenerator
|
||||
* Add support for generating Intune settings catalog policies
|
||||
* M365DSCDRGUtil
|
||||
* Add multiple commands for Intune policies that use the settings catalog
|
||||
* DEPENDENCIES
|
||||
* Updated DSCParser to version 2.0.0.5.
|
||||
* Rolling back ExchangeOnlineManagement to version 3.4.0.'
|
||||
* Updated MSCloudLoginAssistant to version 1.1.17.
|
||||
* Updated ReverseDSC to version 2.0.0.20.'
|
||||
|
||||
# Flag to indicate whether the module requires explicit user acceptance for install/update
|
||||
# RequireLicenseAcceptance = $false
|
||||
|
|
|
@ -0,0 +1,136 @@
|
|||
[CmdletBinding()]
|
||||
param(
|
||||
)
|
||||
$M365DSCTestFolder = Join-Path -Path $PSScriptRoot `
|
||||
-ChildPath '..\..\Unit' `
|
||||
-Resolve
|
||||
$CmdletModule = (Join-Path -Path $M365DSCTestFolder `
|
||||
-ChildPath '\Stubs\Microsoft365.psm1' `
|
||||
-Resolve)
|
||||
$GenericStubPath = (Join-Path -Path $M365DSCTestFolder `
|
||||
-ChildPath '\Stubs\Generic.psm1' `
|
||||
-Resolve)
|
||||
Import-Module -Name (Join-Path -Path $M365DSCTestFolder `
|
||||
-ChildPath '\UnitTestHelper.psm1' `
|
||||
-Resolve)
|
||||
|
||||
$Global:DscHelper = New-M365DscUnitTestHelper -StubModule $CmdletModule `
|
||||
-DscResource 'AADAuthenticationFlowPolicy' -GenericStubModule $GenericStubPath
|
||||
Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
|
||||
InModuleScope -ModuleName $Global:DscHelper.ModuleName -ScriptBlock {
|
||||
Invoke-Command -ScriptBlock $Global:DscHelper.InitializeScript -NoNewScope
|
||||
BeforeAll {
|
||||
$secpasswd = ConvertTo-SecureString (New-Guid | Out-String) -AsPlainText -Force
|
||||
$Credential = New-Object System.Management.Automation.PSCredential ('tenantadmin@contoso.onmicrosoft.com', $secpasswd)
|
||||
|
||||
Mock -CommandName Confirm-M365DSCDependencies -MockWith {
|
||||
}
|
||||
|
||||
Mock -CommandName Update-MgBetaPolicyAuthenticationFlowPolicy -MockWith {
|
||||
}
|
||||
|
||||
Mock -CommandName New-M365DSCConnection -MockWith {
|
||||
return 'Credentials'
|
||||
}
|
||||
|
||||
# Mock Write-Host to hide output during the tests
|
||||
Mock -CommandName Write-Host -MockWith {
|
||||
}
|
||||
$Script:exportedInstances =$null
|
||||
$Script:ExportMode = $false
|
||||
}
|
||||
|
||||
# Test contexts
|
||||
Context -Name 'Value is already in the desired state.' -Fixture {
|
||||
BeforeAll {
|
||||
$testParams = @{
|
||||
Credential = $Credential;
|
||||
Description = "Description Text.";
|
||||
DisplayName = "Authentication flows policy";
|
||||
Id = "authenticationFlowsPolicy";
|
||||
IsSingleInstance = "Yes";
|
||||
SelfServiceSignUpEnabled = $True;
|
||||
}
|
||||
|
||||
Mock -CommandName Get-MgBetaPolicyAuthenticationFlowPolicy -MockWith {
|
||||
$result = @{
|
||||
Id = 'authenticationFlowsPolicy'
|
||||
DisplayName = 'Authentication flows policy'
|
||||
Description = 'Description Text.'
|
||||
SelfServiceSignUp = @{
|
||||
IsEnabled = $true
|
||||
}
|
||||
}
|
||||
return $result
|
||||
}
|
||||
}
|
||||
|
||||
It 'Should return true from the test method' {
|
||||
Test-TargetResource @testParams | Should -Be $true
|
||||
}
|
||||
}
|
||||
|
||||
Context -Name 'Value is already in the desired state.' -Fixture {
|
||||
BeforeAll {
|
||||
$testParams = @{
|
||||
Credential = $Credential;
|
||||
Description = "Description Text.";
|
||||
DisplayName = "Authentication flows policy";
|
||||
Id = "authenticationFlowsPolicy";
|
||||
IsSingleInstance = "Yes";
|
||||
SelfServiceSignUpEnabled = $True;
|
||||
}
|
||||
|
||||
Mock -CommandName Get-MgBetaPolicyAuthenticationFlowPolicy -MockWith {
|
||||
$result = @{
|
||||
Id = 'authenticationFlowsPolicy'
|
||||
DisplayName = 'Authentication flows policy'
|
||||
Description = 'Description Text.'
|
||||
SelfServiceSignUp = @{
|
||||
IsEnabled = $false #drift
|
||||
}
|
||||
}
|
||||
return $result
|
||||
}
|
||||
}
|
||||
|
||||
It 'Should return true from the test method' {
|
||||
Test-TargetResource @testParams | Should -Be $false
|
||||
}
|
||||
|
||||
It 'Should update from the Set method' {
|
||||
Set-TargetResource @testParams
|
||||
Should -Invoke -CommandName Update-MgBetaPolicyAuthenticationFlowPolicy -Exactly 1
|
||||
}
|
||||
}
|
||||
|
||||
Context -Name 'ReverseDSC Tests' -Fixture {
|
||||
BeforeAll {
|
||||
$Global:CurrentModeIsExport = $true
|
||||
$Global:PartialExportFileName = "$(New-Guid).partial.ps1"
|
||||
$testParams = @{
|
||||
Credential = $Credential
|
||||
}
|
||||
|
||||
Mock -CommandName Get-MgBetaPolicyAuthenticationFlowPolicy -MockWith {
|
||||
$result = @{
|
||||
Id = 'authenticationFlowsPolicy'
|
||||
DisplayName = 'Authentication flows policy'
|
||||
Description = 'Description Text.'
|
||||
SelfServiceSignUp = @{
|
||||
IsEnabled = $true
|
||||
}
|
||||
}
|
||||
return $result
|
||||
}
|
||||
}
|
||||
|
||||
It 'Should reverse engineer resource from the export method' {
|
||||
$result = Export-TargetResource @testParams
|
||||
$result | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Invoke-Command -ScriptBlock $Global:DscHelper.CleanupScript -NoNewScope
|
|
@ -1207,6 +1207,22 @@ function Get-MgBetaRoleManagementEntitlementManagementRoleDefinition
|
|||
)
|
||||
}
|
||||
|
||||
function Get-MgBetaPolicyAuthenticationFlowPolicy
|
||||
{
|
||||
[CmdletBinding()]
|
||||
param()
|
||||
}
|
||||
|
||||
function Update-MgBetaPolicyAuthenticationFlowPolicy
|
||||
{
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter()]
|
||||
[System.Boolean]
|
||||
$SelfServiceSignUp
|
||||
)
|
||||
}
|
||||
|
||||
function New-MgBetaRoleManagementEntitlementManagementRoleAssignment
|
||||
{
|
||||
[CmdletBinding()]
|
||||
|
|
Загрузка…
Ссылка в новой задаче