使用本節中的指令碼建立使用者,並將其指派給身分識別網域中預先定義的角色。
以具備身分識別網域管理員角色的服務管理員身分登入環境。
從環境匯出群組和成員資訊,以重新產生您指定的快照;例如,example_snapshot.zip。假設您先前使用移轉來匯出「群組」和「成員」物件以建立此快照。
將快照 (example_snapshot.zip) 下載至本機目錄。
從環境刪除快照 (example_snapshot.zip)。
登出環境。
為您新增的自訂程式碼執行作業。此類作業可能包括:
example_snapshot.zip 的內容HSS-Shared Services\resource\External Directory\Users.csv。如需詳細資訊,請參閱Oracle Cloud 快速入門 中的批次匯入使用者帳戶。HSS-Shared Services\resource\External Directory\Roles\ 中的適當角色檔案。例如,服務管理員角色的指派應該附加至 <service_name> Service Administrator.csv,「檢視者」角色的指派應該附加至 HSS-Shared Services\resource\External Directory\Roles\<service_name> Viewer.csv。如需詳細資訊,請參閱Oracle Cloud 快速入門 中的指派一個角色給多個使用者。HSS-Shared Services 目錄及其內容,以使用更新的檔案重新建立快照。以同時具有識別網域管理員角色的服務管理員身分登入環境。
將修改過的 example_snapshot.zip 上傳至環境。
將 example_snapshot.zip 匯入至環境
從環境刪除上傳的 example_snapshot.zip。
登出。
Windows 範例指令碼
透過複製下列指令碼以建立名為createUsersAndAssignRoles.ps1 的檔案。將它儲存至本機目錄。
$inputproperties = ConvertFrom-StringData(Get-Content ./input.properties -raw)
$username="$($inputproperties.username)"
$passwordfile="$($inputproperties.passwordfile)"
$serviceURL="$($inputproperties.serviceURL)"
$snapshotName="$($inputproperties.snapshotName)"
$userspassword="$($inputproperties.userspassword)"
$resetPassword="$($inputproperties.resetPassword)"
epmautomate login ${username} ${passwordfile} ${serviceURL}
epmautomate exportsnapshot ${snapshotName}
epmautomate downloadfile ${snapshotName}.zip
epmautomate deletefile ${snapshotName}.zip
epmautomate logout
# Add custom code to extract the contents of example_snapshot.zip
# Add custom code to append new user information to HSS-Shared Services\resource\External Directory\Users.csv
# Optional: Add custom code to append role information to the appropriate role file(s) in HSS-Shared Services\resource\External Directory\Roles\
# Add custom code to zip HSS-Shared Services and its contents as example_snapshot.zip
epmautomate login ${username} ${passwordfile} ${serviceURL}
epmautomate uploadfile ${snapshotName}.zip
epmautomate importsnapshot ${snapshotName} userPassword=${userspassword} resetPassword=${resetPassword}
epmautomate deletefile ${snapshotName}.zip
epmautomate logout
Linux/UNIX 範例指令碼
透過複製下列指令碼以建立名為createUsersAndAssignRoles.sh 的檔案。將它儲存至本機目錄。
#!/bin/bash
. ./input.properties
export JAVA_HOME=${javahome}
${epmautomatescript} login "${username}" "${passwordfile}" "${serviceURL}"
${epmautomatescript} exportsnapshot "${snapshotName}"
${epmautomatescript} downloadfile "${snapshotName}.zip"
${epmautomatescript} deletefile "${snapshotName}.zip"
${epmautomatescript} logout
# Add custom code to extract the contents of example_snapshot.zip
# Add custom code to append new user information to HSS-Shared Services\resource\External Directory\Users.csv
# Optional: Add custom code to append role information to the appropriate role file(s) in HSS-Shared Services\resource\External Directory\Roles\
# Add custom code to zip HSS-Shared Services and its contents as example_snapshot.zip
${epmautomatescript} login "${username}" "${passwordfile}" "${serviceURL}"
${epmautomatescript} uploadfile "${snapshotName}.zip"
${epmautomatescript} importsnapshot "${snapshotName}" "userPassword=${userspassword}" "resetPassword=${resetPassword}"
${epmautomatescript} deletefile "${snapshotName}.zip"
${epmautomatescript} logout範例 input.properties 檔案
若要執行createUsersAndAssignRoles 指令碼,請建立 input.properties 檔案並根據您的環境資訊予以更新。將檔案儲存至 createUsersAndAssignRoles.ps1 或 createUsersAndAssignRoles.sh 所在的目錄。
Windows
username=exampleAdmin passwordfile=examplePassword.epw serviceURL=exampleURL snapshotName=SNAPSHOT_NAME userspassword=TEMP_IDM_PASSWORD resetPassword=true
Linux/UNIX
javahome=JAVA_HOME epmautomatescript=EPM_AUTOMATE_LOCATION username=exampleAdmin passwordfile=examplePassword.epw serviceURL=exampleURL snapshotName=SNAPSHOT_NAME userspassword=TEMP_IDM_PASSWORD resetPassword=true
表格 3-2 input.properties 參數
| 參數 | 描述 |
|---|---|
javahome |
JAVA_HOME 位置。僅適用於 Linux/UNIX。 |
epmautomatescript |
EPM Automate 執行檔 (epmautomate.sh) 的絕對路徑。僅適用於 Linux/UNIX。 |
username |
服務管理員的使用者名稱,該管理員也具備身分識別網域管理員角色。 |
password |
服務管理員的密碼,或加密密碼檔案所在的名稱和位置。 |
serviceURL |
環境的 URL,您會從這個環境產生快照。 |
snapshotName |
您想產生之快照的名稱。假設您先前使用移轉來匯出「群組」和「成員」物件以建立此快照。 |
userspassword |
新使用者的初始密碼。 |
resetPassword |
新使用者是否必須在初次登入時重設密碼。將這個值設定為 true,以強制新使用者在初次登入時變更密碼。 |
執行指令碼
createUsersAndAssignRoles.ps1 或 createUsersAndAssignRoles.sh。HSS-Shared Services\resource\External Directory\Users.csv。HSS-Shared Services\resource\External Directory\Roles\ 中的適當角色檔案。input.properties 檔案並將它儲存至 createUsersAndAssignRoles 指令碼所在的目錄。此檔案的內容因作業系統而異。請參閱範例 input.properties 檔案。
確保您在此目錄中具有寫入權限。至於 Windows,您可能需要使用以管理員身分執行選項來啟動 PowerShell,才能執行指令碼。
createUsersAndAssignRoles.ps1。./createUsersAndAssignRoles.sh。