สร้างแอปพลิเคชันบริการ Secure Store ใน SharePoint Server โดยใช้ PowerShell
สคริปต์ PowerShell เพื่อสร้างแอปพลิเคชันบริการร้านค้าที่ปลอดภัยของ SharePoint 2013/2016:
Secure Store Service ได้รับการแนะนำเพื่อแทนที่ฟีเจอร์ SSO ตั้งแต่ SharePoint 2010 Secure Store Service เป็นบริการที่ใช้ร่วมกันที่ให้ที่เก็บข้อมูลและการแมปข้อมูลประจำตัว เช่น ชื่อบัญชีและรหัสผ่าน ช่วยแก้ปัญหาการต้องลงชื่อเข้าใช้หลายแอปพลิเคชันและการป้อนชื่อผู้ใช้และรหัสผ่านที่แตกต่างกัน ช่วยให้คุณสามารถจัดเก็บข้อมูลได้อย่างปลอดภัยซึ่งให้ข้อมูลประจำตัวที่จำเป็นในการเชื่อมต่อกับระบบภายนอก และเชื่อมโยงข้อมูลประจำตัวเหล่านั้นกับข้อมูลเฉพาะตัวหรือกลุ่มข้อมูลเฉพาะตัว การสร้างแอปพลิเคชันบริการร้านค้าที่ปลอดภัยผ่านไซต์การดูแลระบบ SharePoint Central มีอธิบายไว้ที่นี่: กำหนดค่าแอปพลิเคชันบริการร้านค้าที่ปลอดภัยใน SharePoint 2016
สร้างแอปพลิเคชันบริการร้านค้าที่ปลอดภัยโดยใช้ PowerShell ใน SharePoint 2016:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Configuration Parameters
$ServiceAppName = "Secure Store Service Application"
$ServiceAppProxyName = "Secure Store Service Application Proxy"
$AppPoolAccount = "Crescent\SP16-AppPool"
$AppPoolName = "Service Application App Pool"
$DatabaseServer ="SP16-SQL001"
$DatabaseName = "SP16_Service_SecureStore"
Try {
#Set the Error Action
$ErrorActionPreference = "Stop"
#Check if Managed account is registered already
Write-Host -ForegroundColor Yellow "Checking if the Managed Accounts already exists"
$AppPoolAccount = Get-SPManagedAccount -Identity $AppPoolAccount -ErrorAction SilentlyContinue
if($AppPoolAccount -eq $null)
{
Write-Host "Please Enter the password for the Service Account..."
$AppPoolCredentials = Get-Credential $AppPoolAccount
$AppPoolAccount = New-SPManagedAccount -Credential $AppPoolCredentials
}
#Check if the application pool exists already
Write-Host -ForegroundColor Yellow "Checking if the Application Pool already exists"
$AppPool = Get-SPServiceApplicationPool -Identity $AppPoolName -ErrorAction SilentlyContinue
if ($AppPool -eq $null)
{
Write-Host -ForegroundColor Green "Creating Application Pool..."
$AppPool = New-SPServiceApplicationPool -Name $AppPoolName -Account $AppPoolAccount
}
#Check if the Service application exists already
Write-Host -ForegroundColor Yellow "Checking if Secure Store Service Application exists already"
$ServiceApplication = Get-SPServiceApplication -Name $ServiceAppName -ErrorAction SilentlyContinue
if ($ServiceApplication -eq $null)
{
Write-Host -ForegroundColor Green "Creating Secure Store Service Application..."
$ServiceApplication = New-SPSecureStoreServiceApplication -Name $ServiceAppName -ApplicationPool $AppPoolName -DatabaseName $DatabaseName -DatabaseServer $DatabaseServer -AuditingEnabled:$false
$ServiceApplicationProxy = New-SPSecureStoreServiceApplicationProxy -Name $ServiceAppName" Proxy" -ServiceApplication $ServiceApplication -DefaultProxyGroup
}
#Start service instance
$ServiceInstance = Get-SPServiceInstance | Where-Object { $_.TypeName -like "*Secure Store Service*" }
#Check the Service status
if ($ServiceInstance.Status -ne "Online")
{
Write-Host -ForegroundColor Yellow "Starting the Secure Store Service Instance..."
Start-SPServiceInstance $ServiceInstance
}
Write-Host -ForegroundColor Green "Secure Store Service Application created successfully!"
}
catch {
Write-Host $_.Exception.Message -ForegroundColor Red
}
finally {
#Reset the Error Action to Default
$ErrorActionPreference = "Continue"
}
สร้างมาสเตอร์คีย์สำหรับบริการ Secure Store โดยใช้ PowerShell:
#Config parameters
$Passphrase = "Password1"
$ServiceAppProxyName="Secure Store Service Application Proxy"
#Get the Service App Proxy
$ServiceAppProxy = Get-SPServiceApplicationProxy | where { $_.Name -eq $ServiceAppProxyName}
#Create Master key
Update-SPSecureStoreMasterKey -ServiceApplicationProxy $ServiceAppProxy -Passphrase $Passphrase
อย่าลืมเปลี่ยนค่าในส่วน #Configuration parameters!