توصيل Azure Front Door Premium بإدارة واجهة برمجة تطبيقات Azure باستخدام Private Link (معاينة)
ترشدك هذه المقالة خلال خطوات تكوين Azure Front Door Premium للاتصال بشكل خاص بأصل Azure API Management باستخدام Azure Private Link.
المتطلبات الأساسية
حساب Azure مع اشتراك نشط. أنشئ حساباً مجاناً.
Azure PowerShell مثبت محليًا أو Azure Cloud Shell.
إشعار
نوصي باستخدام الوحدة النمطية Azure Az PowerShell للتفاعل مع Azure. للبدء، راجع تثبيت Azure PowerShell. لمعرفة كيفية الترحيل إلى الوحدة النمطية Az PowerShell، راجع ترحيل Azure PowerShell من AzureRM إلى Az.
Azure Cloud Shell
Azure يستضيف Azure Cloud Shell، بيئة تفاعلية يمكن استخدامها من خلال المستعرض. يمكنك استخدام Bash أو PowerShell مع Cloud Shell للعمل مع خدمات Azure. يمكنك استخدام أوامر Cloud Shell المثبتة مسبقًا لتشغيل التعليمات البرمجية في هذه المقالة دون الحاجة إلى تثبيت أي شيء على البيئة المحلية.
لبدء Azure Cloud Shell:
خيار | مثال/ رابط |
---|---|
انقر فوق جربه في الزاوية العلوية اليسرى من التعليمة البرمجية أو كتلة الأمر. تحديد جربه لا يقوم بنسخ التعليمة البرمجية أو الأمر تلقائيًا إلى Cloud Shell. | |
انتقل إلى https://shell.azure.com، أو حدد زر تشغيل Cloud Shell لفتح Cloud Shell في المتصفح لديك. | |
حدد زر Cloud Shell على شريط القوائم في أعلى اليمين في مدخل Microsoft Azure. |
لاستخدام Azure Cloud Shell:
ابدأ تشغيل Cloud Shell.
حدد الزر نسخ على كتلة التعليمات البرمجية (أو كتلة الأوامر) لنسخ التعليمات البرمجية أو الأمر.
ألصق التعليمة البرمجية أو الأمر في جلسة Cloud Shell بتحديد Ctrl+Shift+Vعلى Windows وLunix، أو بتحديد Cmd+Shift+Vعلى macOS.
حدد Enter لتشغيل التعليمات البرمجية أو الأمر.
لديك مثيل Azure API Management يعمل. لمزيد من المعلومات حول كيفية إنشاء مثيل APIM، راجع إنشاء مثيل Azure API Management جديد باستخدام PowerShell
لديك ملف تعريف Azure Front Door Premium ونقطة نهاية فعالة. لمزيد من المعلومات حول كيفية إنشاء ملف تعريف Azure Front Door، راجع إنشاء Front Door - PowerShell
إنشاء مجموعة أصل وإضافة مثيل APIM كأصل
استخدم New-AzFrontDoorCdnOriginGroupHealthProbeSettingObject لإنشاء كائن في الذاكرة لتخزين إعدادات فحص السلامة.
$healthProbeSetting = New-AzFrontDoorCdnOriginGroupHealthProbeSettingObject ` -ProbeIntervalInSecond 60 ` -ProbePath "/" ` -ProbeRequestType GET ` -ProbeProtocol Http
استخدم New-AzFrontDoorCdnOriginGroupLoadBalancingSettingObject لإنشاء كائن في الذاكرة لتخزين إعدادات موازنة التحميل.
$loadBalancingSetting = New-AzFrontDoorCdnOriginGroupLoadBalancingSettingObject ` -AdditionalLatencyInMillisecond 50 ` -SampleSize 4 ` -SuccessfulSamplesRequired 3
قم بتشغيل New-AzFrontDoorCdnOriginGroup لإنشاء مجموعة أصل تحتوي على مثيل APIM الخاص بك.
$origingroup = New-AzFrontDoorCdnOriginGroup ` -OriginGroupName myOriginGroup ` -ProfileName myFrontDoorProfile ` -ResourceGroupName myResourceGroup ` -HealthProbeSetting $healthProbeSetting ` -LoadBalancingSetting $loadBalancingSetting
استخدم الأمر New-AzFrontDoorCdnOrigin لإضافة مثيل APIM إلى مجموعة الأصل.
New-AzFrontDoorCdnOrigin ` -OriginGroupName myOriginGroup ` -OriginName myAPIMOrigin ` -ProfileName myFrontDoorProfile ` -ResourceGroupName myResourceGroup ` -HostName myapim.azure-api.net ` -HttpPort 80 ` -HttpsPort 443 ` -OriginHostHeader myapim.azure-api.net ` -Priority 1 ` -PrivateLinkId /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/myResourceGroup/providers/Microsoft.ApiManagement/service/myAPIM ` -SharedPrivateLinkResourceGroupId Gateway ` -SharedPrivateLinkResourcePrivateLinkLocation CentralUS ` -SharedPrivateLinkResourceRequestMessage 'Azure Front Door private connectivity request' ` -Weight 1000 `
الموافقة على نقطة النهاية الخاصة
قم بتشغيل Get-AzPrivateEndpointConnection لاسترداد اسم الاتصال لاتصال نقطة النهاية الخاصة التي تحتاج إلى الموافقة.
$PrivateEndpoint = Get-AzPrivateEndpointConnection -ResourceGroupName myResourceGroup -ServiceName myAPIM -PrivateLinkResourceType Microsoft.ApiManagement/service
قم بتشغيل Approve-AzPrivateEndpointConnection للموافقة على تفاصيل اتصال نقطة النهاية الخاصة. استخدم قيمة الاسم من الإخراج في الخطوة السابقة للموافقة على الاتصال.
Get-AzPrivateEndpointConnection -Name $PrivateEndpoint.Name -ResourceGroupName myResourceGroup -ServiceName myAPIM -PrivateLinkResourceType Microsoft.ApiManagement/service
إكمال إعداد Azure Front Door
استخدم الأمر New-AzFrontDoorCdnRoute لإنشاء مسار يعين نقطة النهاية إلى مجموعة الأصل. يقوم هذا المسار بإعادة توجيه الطلبات من نقطة النهاية إلى مجموعة الأصل الخاصة بك.
# Create a route to map the endpoint to the origin group
$Route = New-AzFrontDoorCdnRoute `
-EndpointName myFrontDoorEndpoint `
-Name myRoute `
-ProfileName myFrontDoorProfile `
-ResourceGroupName myResourceGroup `
-ForwardingProtocol MatchRequest `
-HttpsRedirect Enabled `
-LinkToDefaultDomain Enabled `
-OriginGroupId $origingroup.Id `
-SupportedProtocol Http,Https
يعمل ملف تعريف Azure Front Door الآن بكامل طاقته بعد إكمال الخطوة الأخيرة.
المتطلبات الأساسية
استخدم بيئة Bash في Azure Cloud Shell. لمزيد من المعلومات، راجع التشغيل السريع ل Bash في Azure Cloud Shell.
إذا كنت تفضل تشغيل أوامر مرجع CLI محلياً قم بتثبيت CLI Azure. إذا كنت تعمل على نظام تشغيل Windows أو macOS، ففكر في تشغيل Azure CLI في حاوية Docker. لمزيد من المعلومات، راجع كيفية تشغيل Azure CLI في حاوية Docker.
إذا كنت تستخدم تثبيت محلي، يُرجى تسجيل الدخول إلى Azure CLI مستخدمًا أمر az login. لإنهاء عملية المصادقة، اتبع الخطوات المعروضة في جهازك. للحصول على خيارات أخرى لتسجيل دخول، راجع تسجيل الدخول باستخدام Azure CLI.
عندما يُطلب منك، قم بتثبيت ملحق Azure CLI عند الاستخدام لأول مرة. لمزيد من المعلومات بشأن الامتدادات، راجع استخدام امتدادات مع Azure CLI.
يُرجى تشغيل إصدار az للوصول إلى الإصدار والمكتبات التابعة التي تم تثبيتها. للتحديث لآخر إصدار، يُرجى تشغيل تحديث az.
حساب Azure مع اشتراك نشط. أنشئ حساباً مجاناً.
ملف تعريف ونقطة نهاية Azure Front Door Premium يعملان. راجع إنشاء Front Door - CLI.
مثيل Azure API Management يعمل. راجع إنشاء مثيل Azure API Management جديد باستخدام Azure CLI
إنشاء مجموعة أصل وإضافة مثيل APIM كأصل
قم بتشغيل az afd origin-group create لإنشاء مجموعة أصل.
az afd origin-group create \ --resource-group myResourceGroup \ --origin-group-name myOriginGroup \ --profile-name myFrontDoorProfile \ --probe-request-type GET \ --probe-protocol Http \ --probe-interval-in-seconds 60 \ --probe-path / \ --sample-size 4 \ --successful-samples-required 3 \ --additional-latency-in-milliseconds 50
قم بتشغيل az afd origin create لإضافة مثيل APIM كأصل إلى مجموعة الأصل.
az afd origin create \ --enabled-state Enabled \ --resource-group myResourceGroup \ --origin-group-name myOriginGroup \ --origin-name myAPIMOrigin \ --profile-name myFrontDoorProfile \ --host-name myapim.azure-api.net \ --origin-host-header myapim.azure-api.net \ --http-port 80 \ --https-port 443 \ --priority 1 \ --weight 500 \ --enable-private-link true \ --private-link-location centralus \ --private-link-request-message 'Azure Front Door private connectivity request.' \ --private-link-resource /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/myResourceGroup/providers/Microsoft.ApiManagement/service/myAPIM \ --private-link-sub-resource-type Gateway
الموافقة على اتصال نقطة النهاية الخاصة
قم بتشغيل az network private-endpoint-connection list للحصول على اسم اتصال نقطة النهاية الخاصة التي تحتاج إلى الموافقة.
az network private-endpoint-connection list --name myAPIM --resource-group myResourceGroup --type Microsoft.ApiManagement/service
قم بتشغيل az network private-endpoint-connection approve to approve the private endpoint connection using the name from the previous step.
az network private-endpoint-connection approve --id /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/myResourceGroup/providers/Microsoft.ApiManagement/service/myAPIM/privateEndpointConnections/aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb
إكمال إعداد Azure Front Door
قم بتشغيل az afd route create لإنشاء مسار يقوم بتعيين نقطة النهاية الخاصة بك إلى مجموعة الأصل. يقوم هذا المسار بإعادة توجيه الطلبات من نقطة النهاية إلى مجموعة الأصل الخاصة بك.
az afd route create \
--resource-group myResourceGroup \
--profile-name myFrontDoorProfile \
--endpoint-name myFrontDoorEndpoint \
--forwarding-protocol MatchRequest \
--route-name myRoute \
--https-redirect Enabled \
--origin-group myOriginGroup \
--supported-protocols Http Https \
--link-to-default-domain Enabled
يعمل ملف تعريف Azure Front Door الآن بكامل طاقته بعد إكمال الخطوة الأخيرة.
الخطوات التالية
تعرف على خدمة Private Link مع حساب تخزين.