承認規則は、VBScript または JScript で作成したスクリプトで、役割の定義やタスクの定義に含めることができます。承認規則は、役割やタスクを有効にするかどうかを決定します。

承認規則を使用すると、スクリプトで判断できる条件に基づいて承認を決定することができます。これらの条件には、特権やアクセス許可、時刻、請求可能な経費の上限、残高などの基準があります。

承認マネージャーは、承認規則の記述やデバッグの用途向けには設計されていません。スクリプトは、テキスト エディター (たとえば、メモ帳)、Visual Studio .NET などの統合開発環境、または他のアプリケーションを使って作成できます。承認規則は通常、専門の開発者が作成します。

承認規則の作成と承認マネージャー アプリケーション プログラミング インターフェイス (API) の使用の詳細については、承認マネージャー モデルに関するページ (英語の可能性あり) (https://go.microsoft.com/fwlink/?linkid=64027) を参照してください。その他の参考になるリンクについては、「承認マネージャーのリソース」を参照してください。

ビジネス規則や承認規則の使用を制御する

各クライアントで使用を制御する

Windows Server 2008 から、ビジネス規則や承認規則の使用は、レジストリ設定によって制御できるようになりました。規則は、既定では無効にされます。以前のバージョンの Windows では、この機能はサポートされていませんでした。

一般的に、環境内に承認規則やビジネス規則が使用されている場合、セットアップ プログラムまたはオペレーティング システムによって実行されるスクリプトを使用して、それらの規則を有効にします。

重要

この設定は、各クライアントで、承認マネージャー アプリケーションごとに個別に制御されます。

次に示すのは、あるアプリケーションで、ビジネス規則とアプリケーション規則を有効または無効にするサンプル スクリプトです。

'

' Enabling or disabling BizRules for an application

' This script uses Authorization Manager Administrative interfaces to enable or disable

' BizRules for a specified Authorization Manager application in a specified Authorization Manager policy store

On Error Resume Next

Set objArgs = WScript.Arguments

If objArgs.count <> 3 then

wscript.echo "Usage: SetBizRule ""AzManStoreURL"" ""AzApplicaitonName"" True/False"

wscript.echo "Example: SetBizRule ""msxml://d:\inetpub\wwwroot\AzStore.xml"" ""MyApp"" True"

wscript.echo "Run with 'cscript' command in cmd.exe to avoid msg boxes"

Else

' VBScript source code

Dim AzStoreObj

Dim AzManStoreURL : AzManStoreURL = objArgs(0)

Dim AzManAppName : AzManAppName = objArgs(1)

Dim BizRulesEnabled : BizRulesEnabled = objArgs(2)

' create azman object

Set AzStoreObj = CreateObject("AzRoles.AzAuthorizationStore")

If Err.Number > 0 Then

WScript.Echo "Can not create AzRoles.AzAuthorizationStore. Check Authorization Manager installation"

WScript.Quit

End If

' initialize store for Administration

' assumes store exists - if store is being created (e.g. an installing applicaion)

' use the value 3 instead of 2 in the call to IAzAuthorizationStore::initialize

Err.Clear

AzStoreObj.Initialize 2, AzManStoreURL

If Err.Number <> 0 Then

WScript.Echo "AzRoles.AzAuthorizationStore failed to initialize. Check store URL"

WScript.Quit

End If

' open applicaion

set AzApp = AzStoreObj.OpenApplication(AzManAppName)

If Err.Number <> 0 Then

WScript.Echo "AzRoles.AzAuthorizationStore failed to open application: " + AzManAppName + ". Check application Name."

WScript.Quit

End If

' set BizRulesEnabled property

WSCript.Echo "App BizRule Before:" & AzApp.BizRulesEnabled

AzApp.BizRulesEnabled = BizRulesEnabled

WSCript.Echo "App BizRule After:" & AzApp.BizRulesEnabled

If Err.Number = 0 Then

WScript.Echo "BizRulesEnabled is updated successfully."

Else

WScript.Echo "BizRulesEnabled is NOT updated successfully."

End If

End if

承認ストア全体に対する使用を制御する

承認ストアのプロパティ シートの [制限値] タブで承認規則の制限を構成すると、次のことができます。

  • ストアの承認規則やビジネス規則を無効にする

  • タイムアウト値を設定し、スクリプトの実行が可能な最大時間を制限する

  • タイムアウトなしでのスクリプトの実行を許可する

詳細については、「承認マネージャー ストアの制限とは」を参照してください。

VBScript の例

次に、アクセス許可を必ず与える VBScript の承認規則を示します。

AzBizRuleContext.BusinessRuleResult = True

VBScript の詳細については、VBScript に関するページ (英語の可能性あり) (https://go.microsoft.com/fwlink/?linkid=65964) を参照してください。

JScript の例

次に、アクセス許可を必ず与える JScript の承認規則を示します。

AzBizRuleContext.BusinessRuleResult = true;

JScript の詳細については、JScript に関するページ (英語の可能性あり) (https://go.microsoft.com/fwlink/?linkid=65963) を参照してください。


目次