New-AzureADMSConditionalAccessPolicy
在 Azure Active Directory 中建立新的條件式存取原則。
語法
New-AzureADMSConditionalAccessPolicy
[-Id <String>]
[-DisplayName <String>]
[-State <String>]
[-Conditions <ConditionalAccessConditionSet>]
[-GrantControls <ConditionalAccessGrantControls>]
[-SessionControls <ConditionalAccessSessionControls>]
[<CommonParameters>]
Description
此 Cmdlet 可讓系統管理員在 Azure Active Directory 中建立新的條件式存取原則。 條件式存取原則是定義存取案例的自定義規則。
範例
範例 1:在 Azure AD 中建立需要 MFA 才能存取 Exchange Online 的新條件式存取原則
PS C:\> $conditions = New-Object -TypeName Microsoft.Open.MSGraph.Model.ConditionalAccessConditionSet
PS C:\> $conditions.Applications = New-Object -TypeName Microsoft.Open.MSGraph.Model.ConditionalAccessApplicationCondition
PS C:\> $conditions.Applications.IncludeApplications = "00000002-0000-0ff1-ce00-000000000000"
PS C:\> $conditions.Users = New-Object -TypeName Microsoft.Open.MSGraph.Model.ConditionalAccessUserCondition
PS C:\> $conditions.Users.IncludeUsers = "all"
PS C:\> $controls = New-Object -TypeName Microsoft.Open.MSGraph.Model.ConditionalAccessGrantControls
PS C:\> $controls._Operator = "OR"
PS C:\> $controls.BuiltInControls = "mfa"
PS C:\> New-AzureADMSConditionalAccessPolicy -DisplayName "MFA policy" -State "Enabled" -Conditions $conditions -GrantControls $controls
Id : 6b5e999b-0ba8-4186-a106-e0296c1c4358
DisplayName : MFA policy
CreatedDateTime : 2019-09-26T23:12:16.0792706Z
ModifiedDateTime : 2019-09-27T00:12:12.5986473Z
State : Enabled
此命令會在 Azure AD 中建立需要 MFA 才能存取 Exchange Online 的新條件式存取原則。
範例 2:在 Azure AD 中建立新的條件式存取原則,以封鎖從非信任區域存取 Exchange Online
PS C:\> $conditions = New-Object -TypeName Microsoft.Open.MSGraph.Model.ConditionalAccessConditionSet
PS C:\> $conditions.Applications = New-Object -TypeName Microsoft.Open.MSGraph.Model.ConditionalAccessApplicationCondition
PS C:\> $conditions.Applications.IncludeApplications = "00000002-0000-0ff1-ce00-000000000000"
PS C:\> $conditions.Users = New-Object -TypeName Microsoft.Open.MSGraph.Model.ConditionalAccessUserCondition
PS C:\> $conditions.Users.IncludeUsers = "all"
PS C:\> $conditions.Locations = New-Object -TypeName Microsoft.Open.MSGraph.Model.ConditionalAccessLocationCondition
PS C:\> $conditions.Locations.IncludeLocations = "198ad66e-87b3-4157-85a3-8a7b51794ee9"
PS C:\> $controls = New-Object -TypeName Microsoft.Open.MSGraph.Model.ConditionalAccessGrantControls
PS C:\> $controls._Operator = "OR"
PS C:\> $controls.BuiltInControls = "block"
PS C:\> New-AzureADMSConditionalAccessPolicy -DisplayName "MFA policy" -State "Enabled" -Conditions $conditions -GrantControls $controls
Id : 6b5e999b-0ba8-4186-a106-e0296c1c4358
DisplayName : MFA policy
CreatedDateTime : 2019-09-26T23:12:16.0792706Z
ModifiedDateTime : 2019-09-27T00:12:12.5986473Z
State : Enabled
範例 3:在 Azure AD 中建立新的條件式存取原則,以封鎖從不符合規範的裝置存取 Exchange Online
PS C:\> $conditions = New-Object -TypeName Microsoft.Open.MSGraph.Model.ConditionalAccessConditionSet
PS C:\> $conditions.Applications = New-Object -TypeName Microsoft.Open.MSGraph.Model.ConditionalAccessApplicationCondition
PS C:\> $conditions.Applications.IncludeApplications = "00000002-0000-0ff1-ce00-000000000000"
PS C:\> $conditions.Users = New-Object -TypeName Microsoft.Open.MSGraph.Model.ConditionalAccessUserCondition
PS C:\> $conditions.Users.IncludeUsers = "all"
PS C:\> $conditions.Devices = New-Object -TypeName Microsoft.Open.MSGraph.Model.ConditionalAccessDevicesCondition
PS C:\> $conditions.Devices.DeviceFilter = New-Object -TypeName Microsoft.Open.MSGraph.Model.ConditionalAccessFilter
PS C:\> $conditions.Devices.DeviceFilter.Mode = "exclude"
PS C:\> $conditions.Devices.DeviceFilter.Rule = "device.isCompliant -eq True"
PS C:\> $controls = New-Object -TypeName Microsoft.Open.MSGraph.Model.ConditionalAccessGrantControls
PS C:\> $controls._Operator = "OR"
PS C:\> $controls.BuiltInControls = "block"
PS C:\> New-AzureADMSConditionalAccessPolicy -DisplayName "Block Non-compliant device policy" -State "Enabled" -Conditions $conditions -GrantControls $controls
Id : c5560f6b-2931-4b40-8e94-8b9e11a507c1
DisplayName : Block Non-compliant device policy
CreatedDateTime : 2022-04-20T15:15:41.9500079Z
ModifiedDateTime :
State : enabled
此命令會在 Azure AD 中建立新的條件式存取原則,以封鎖從非信任區域存取 Exchange Online。 其示範 裝置條件篩選 的使用方式。
參數
-Conditions
指定 Azure Active Directory 中條件式存取原則的條件。
類型: | ConditionalAccessConditionSet |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-DisplayName
指定 Azure Active Directory 中條件式存取原則的顯示名稱。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-GrantControls
指定 Azure Active Directory 中條件式存取原則的控件。
類型: | ConditionalAccessGrantControls |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Id
{{ 填滿標識符描述 }}
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-SessionControls
{{ Fill SessionControls Description }}
類型: | ConditionalAccessSessionControls |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-State
指定 Azure Active Directory 中條件式存取原則的啟用或停用狀態。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |