共用方式為


Add-AzureRmHDInsightStorage

將 Azure 儲存體 金鑰新增至叢集組態物件。

警告

自 2024 年 2 月 29 日起,AzureRM PowerShell 模組已正式淘汰。 建議使用者從 AzureRM 遷移至 Az PowerShell 模組,以確保持續支援和更新。

雖然 AzureRM 模組可能仍可運作,但不再維護或支援它,但會根據用戶的判斷權和風險放置任何繼續使用。 如需轉換至 Az 模組的指引,請參閱我們的 移轉資源

語法

Add-AzureRmHDInsightStorage
   [-Config] <AzureHDInsightConfig>
   [-StorageAccountName] <String>
   [-StorageAccountKey] <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

Add-AzureRmHDInsight 儲存體 Cmdlet 會將 Azure 儲存體 帳戶專案新增至 New-AzureRmHDInsightClusterConfig Cmdlet 所建立的 Azure HDInsight 組態物件。

範例

範例 1:將 Azure 記憶體金鑰新增至叢集組態物件

PS C:\># Primary storage account info
PS C:\> $storageAccountResourceGroupName = "Group"
PS C:\> $storageAccountName = "yourstorageacct001"
PS C:\> $storageAccountKey = (Get-AzureRmStorageAccountKey -ResourceGroupName $storageAccountResourceGroupName -Name $storageAccountName)[0].value


PS C:\> $storageContainer = "container001"

# Cluster configuration info
PS C:\> $location = "East US 2"
PS C:\> $clusterResourceGroupName = "Group"
PS C:\> $clusterName = "your-hadoop-001"
PS C:\> $clusterCreds = Get-Credential

# If the cluster's resource group doesn't exist yet, run:
#   New-AzureRmResourceGroup -Name $clusterResourceGroupName -Location $location

# Second storage account info
PS C:\> $secondStorageAccountResourceGroupName = "Group"
PS C:\> $secondStorageAccountName = "yourstorageacct002"
PS C:\> $secondStorageAccountKey = Get-AzureRmStorageAccountKey `
PS C:\> -ResourceGroupName $secondStorageAccountResourceGroupName `
            -Name $secondStorageAccountName | %{ $_.Key1 }

# Create the cluster
PS C:\> New-AzureRmHDInsightClusterConfig `
            | Add-AzureRmHDInsightStorage `
                -StorageAccountName "$secondStorageAccountName.blob.core.contoso.net" `
                -StorageAccountKey $key2 `
            | New-AzureRmHDInsightCluster `
                -ClusterType Hadoop `
                -OSType Windows `
                -ClusterSizeInNodes 4 `
                -ResourceGroupName $clusterResourceGroupName `
                -ClusterName $clusterName `
                -HttpCredential $clusterCreds `
                -Location $location `
                -DefaultStorageAccountName "$storageAccountName.blob.core.contoso.net" `
                -DefaultStorageAccountKey $storageAccountKey `
                -DefaultStorageContainer $storageContainer

此命令會將 Blob 記憶體帳戶專案新增至名為 your-hadoop-001 的 HDInsight 組態。

參數

-Config

指定此 Cmdlet 修改的 HDInsight 叢集組態物件。 此物件是由 New-AzureRmHDInsightClusterConfig Cmdlet 所建立。

類型:AzureHDInsightConfig
Position:0
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-DefaultProfile

用於與 azure 通訊的認證、帳戶、租用戶和訂用帳戶

類型:IAzureContextContainer
別名:AzureRmContext, AzureCredential
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-StorageAccountKey

指定要新增至新叢集之記憶體帳戶的記憶體帳戶的記憶體帳戶密鑰。

類型:String
Position:2
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-StorageAccountName

指定要新增至叢集之記憶體帳戶的記憶體帳戶名稱。

類型:String
Position:1
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

輸入

AzureHDInsightConfig

參數:設定(ByValue)

輸出

AzureHDInsightConfig