このスクリプトは、BLOB ストレージ アカウントのイベントに対する Event Grid サブスクリプションを作成します。
注
Azure Az PowerShell モジュールを使用して Azure と対話することをお勧めします。 作業を始めるには、「Azure PowerShell をインストールする」を参照してください。 Az PowerShell モジュールに移行する方法については、「 Azure PowerShell を AzureRM から Az に移行する」を参照してください。
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 のドキュメントをご覧ください。