اشترك في الأحداث لحساب تخزين Blob باستخدام PowerShell
يعمل هذا البرنامج النصي على إنشاء اشتراك "شبكة الأحداث" للأحداث الخاصة بحساب تخزين الكائنات الثنائية كبيرة الحجم.
إشعار
نوصي باستخدام الوحدة النمطية Azure Az PowerShell للتفاعل مع Azure. للبدء، راجع تثبيت Azure PowerShell. لمعرفة كيفية الترحيل إلى الوحدة النمطية Az PowerShell، راجع ترحيل Azure PowerShell من AzureRM إلى Az.
إذا لم يكن لديك اشتراك في Azure، فأنشئ حساب Azure مجاني قبل أن تبدأ.
نموذج البرنامج النصي - مستقر
# Provide a unique name for the Blob storage account.
$storageName = "<your-unique-storage-name>"
# Provide an endpoint for handling the events. Must be formatted "https://your-endpoint-URL"
$myEndpoint = "<your-endpoint-URL>"
# Provide the name of the resource group to create. It will contain the storage account.
$myResourceGroup="<resource-group-name>"
# Create resource group
New-AzResourceGroup -Name $myResourceGroup -Location westus2
# Create the Blob storage account.
New-AzStorageAccount -ResourceGroupName $myResourceGroup `
-Name $storageName `
-Location westus2 `
-SkuName Standard_LRS `
-Kind BlobStorage `
-AccessTier Hot
# Get the resource ID of the Blob storage account.
$storageId = (Get-AzStorageAccount -ResourceGroupName $myResourceGroup -AccountName $storageName).Id
# Subscribe to the Blob storage account.
New-AzEventGridSubscription `
-EventSubscriptionName demoSubToStorage `
-Endpoint $myEndpoint `
-ResourceId $storageId
شرح السيناريو
يستخدم هذا البرنامج النصي الأمر التالي لإنشاء اشتراك الحدث. يرتبط كل أمر في الجدول بالوثائق الخاصة بالأوامر.
الأمر | ملاحظات |
---|---|
New-AzEventGridSubscription | إنشاء اشتراك Event Grid. |
الخطوات التالية
- للحصول على مقدمة للتطبيقات المدارة، راجع نظرة عامة حول التطبيقات المدارة من Azure.
- لمزيد من المعلومات حول PowerShell، راجع Azure PowerShell documentation".