إشعار
يتطلب الوصول إلى هذه الصفحة تخويلاً. يمكنك محاولة تسجيل الدخول أو تغيير الدلائل.
يتطلب الوصول إلى هذه الصفحة تخويلاً. يمكنك محاولة تغيير الدلائل.
يوضح هذا البرنامج التعليمي كيفية استخدام Power Platform واجهة برمجة التطبيقات (إصدار أولي) لإنشاء إعدادات إدارة البيئة وتحديثها وإدراجها.
في هذه البرنامج التعليمي، تتعلم كيفية:
- المصادقة باستخدام Power Platform واجهة برمجة التطبيقات.
- إنشاء قيمة إعداد جديدة.
- سرد جميع قيم إعداد الإدارة للبيئة.
- تحديث قيمة إعداد.
كمثال على هذا السيناريو، قد يرغب العميل في تشغيل قيود IP لتوقيع الوصول المشترك للتخزين (SAS) وتسجيل مكالمات SAS.
الخطوة 1. المصادقة باستخدام واجهة برمجة تطبيقات Power Platform
استخدم برنامج PowerShell النصي التالي للمصادقة باستخدام واجهة برجة تطبيقات Power Platform.
Import-Module "MSAL.PS"
$AuthResult = Get-MsalToken -ClientId '<client id of your Microsoft Entra ID application registration>' -Scope 'https://api.powerplatform.com/.default'
$Headers = @{Authorization = "Bearer $($AuthResult.AccessToken)"}
الخطوة 2. إنشاء قيمة إعداد جديدة
استخدم البرنامج النصي PowerShell التالي لإنشاء قيمة إعداد جديدة لقيود IP لتوقيع الوصول المشترك للتخزين (SAS)، وإمكانية تسجيل التدقيق ذات الصلة. تم إيقاف تشغيل هذين الإعدادين، ولكننا سنقوم بتحديثهما لاحقا لتشغيلهما.
#Set your environment ID
$environmentId = "ENV_ID_HERE"
# Please uncomment the values that need to be updated
$EnvironmentManagementSettings = @{
"EnableIpBasedStorageAccessSignatureRule" = $false
"LoggingEnabledForIpBasedStorageAccessSignature" = $false
}
$body = $json = $EnvironmentManagementSettings | ConvertTo-Json
try
{
# Create the new setting value
Write-Host "Invoking Create Management Setting for Environment $environmentId with body $body"
$apiResponse = Invoke-WebRequest -Method Post -Uri "https://api.powerplatform.com/environmentmanagement/environments/$environmentId/settings/?api-version=2022-03-01-preview" -Headers $Headers -Body $body
Write-Host "Operation Status: $apiResponse.StatusDescription"
}
catch
{
# Dig into the exception to get the Response details.
Write-Host "Response CorrelationId:" $_.Exception.Response.Headers["x-ms-correlation-id"]
Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__
Write-Host "StatusDescription:" $_.Exception.Response.StatusDescription
$result = $_.Exception.Response.GetResponseStream()
$reader = New-Object System.IO.StreamReader($result)
$reader.BaseStream.Position = 0
$reader.DiscardBufferedData()
$responseBody = $reader.ReadToEnd();
Write-Host $responseBody
}
تعرف على المزيد حول Power Platform مرجع واجهة برمجة التطبيقات في إعدادات إدارة البيئة - إنشاء إعدادات إدارة البيئة.
الخطوة 3. سرد كافة إعدادات الإدارة للبيئة
استخدم البرنامج النصي PowerShell التالي لسرد كافة الإعدادات التي تم إنشاؤها مسبقا لهذه البيئة.
#Set your environment ID
$environmentId = "ENV_ID_HERE"
try
{
# Create the new setting value
Write-Host "Invoking List Management Settings for Environment $environmentId"
$apiResponse = Invoke-WebRequest -Method Get -Uri "https://api.powerplatform.com/environmentmanagement/environments/$environmentId/settings/?api-version=2022-03-01-preview&$select=EnableIpBasedStorageAccessSignatureRule,LoggingEnabledForIpBasedStorageAccessSignature" -Headers $Headers
Write-Host $apiResponse
}
catch
{
# Dig into the exception to get the Response details.
Write-Host "Response CorrelationId:" $_.Exception.Response.Headers["x-ms-correlation-id"]
Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__
Write-Host "StatusDescription:" $_.Exception.Response.StatusDescription
$result = $_.Exception.Response.GetResponseStream()
$reader = New-Object System.IO.StreamReader($result)
$reader.BaseStream.Position = 0
$reader.DiscardBufferedData()
$responseBody = $reader.ReadToEnd();
Write-Host $responseBody
}
تعرف على المزيد حول Power Platform مرجع واجهة برمجة التطبيقات في إعدادات إدارة البيئة - سرد إعدادات إدارة البيئة.
الخطوة 4. تحديث قيمة إعداد
استخدم البرنامج النصي PowerShell التالي لتحديث قيمة إعداد محددة مسبقا. في هذه خطوة، يمكنك تشغيل تسجيل توقيع الوصول المشترك للتخزين (SAS).
#Set your environment ID
$environmentId = "ENV_ID_HERE"
# Please uncomment the values that need to be updated
$EnvironmentManagementSettings = @{
"LoggingEnabledForIpBasedStorageAccessSignature" = $true
}
$body = $json = $EnvironmentManagementSettings | ConvertTo-Json
try
{
# Updating the setting value
Write-Host "Invoking Update Management Setting for Environment $environmentId with body $body"
$apiResponse = Invoke-WebRequest -Method Patch -Uri "https://api.powerplatform.com/environmentmanagement/environments/$environmentId/settings/?api-version=2022-03-01-preview" -Headers $Headers -Body $body
Write-Host "Operation Status: $apiResponse.StatusDescription"
}
catch
{
# Dig into the exception to get the Response details.
Write-Host "Response CorrelationId:" $_.Exception.Response.Headers["x-ms-correlation-id"]
Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__
Write-Host "StatusDescription:" $_.Exception.Response.StatusDescription
$result = $_.Exception.Response.GetResponseStream()
$reader = New-Object System.IO.StreamReader($result)
$reader.BaseStream.Position = 0
$reader.DiscardBufferedData()
$responseBody = $reader.ReadToEnd();
Write-Host $responseBody
}
تعرف على المزيد حول Power Platform مرجع واجهة برمجة التطبيقات في إعدادات إدارة البيئة - تحديث إعدادات إدارة البيئة.