New-AzDeployment
現在のサブスクリプション スコープでデプロイを作成します。
構文
New-AzDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-Tag <Hashtable>]
[-WhatIfResultFormat <WhatIfResultFormat>]
[-WhatIfExcludeChangeType <String[]>]
[-ProceedIfNoChange]
[-AsJob]
[-QueryString <String>]
-TemplateFile <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-Tag <Hashtable>]
[-WhatIfResultFormat <WhatIfResultFormat>]
[-WhatIfExcludeChangeType <String[]>]
[-ProceedIfNoChange]
[-AsJob]
[-QueryString <String>]
-TemplateParameterObject <Hashtable>
-TemplateObject <Hashtable>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-Tag <Hashtable>]
[-WhatIfResultFormat <WhatIfResultFormat>]
[-WhatIfExcludeChangeType <String[]>]
[-ProceedIfNoChange]
[-AsJob]
[-QueryString <String>]
-TemplateParameterObject <Hashtable>
-TemplateFile <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-Tag <Hashtable>]
[-WhatIfResultFormat <WhatIfResultFormat>]
[-WhatIfExcludeChangeType <String[]>]
[-ProceedIfNoChange]
[-AsJob]
[-QueryString <String>]
-TemplateParameterObject <Hashtable>
-TemplateUri <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-Tag <Hashtable>]
[-WhatIfResultFormat <WhatIfResultFormat>]
[-WhatIfExcludeChangeType <String[]>]
[-ProceedIfNoChange]
[-AsJob]
[-QueryString <String>]
-TemplateParameterObject <Hashtable>
-TemplateSpecId <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-Tag <Hashtable>]
[-WhatIfResultFormat <WhatIfResultFormat>]
[-WhatIfExcludeChangeType <String[]>]
[-ProceedIfNoChange]
[-AsJob]
[-QueryString <String>]
-TemplateParameterFile <String>
-TemplateObject <Hashtable>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-Tag <Hashtable>]
[-WhatIfResultFormat <WhatIfResultFormat>]
[-WhatIfExcludeChangeType <String[]>]
[-ProceedIfNoChange]
[-AsJob]
[-QueryString <String>]
-TemplateParameterFile <String>
-TemplateFile <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-Tag <Hashtable>]
[-WhatIfResultFormat <WhatIfResultFormat>]
[-WhatIfExcludeChangeType <String[]>]
[-ProceedIfNoChange]
[-AsJob]
[-QueryString <String>]
-TemplateParameterFile <String>
-TemplateUri <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-Tag <Hashtable>]
[-WhatIfResultFormat <WhatIfResultFormat>]
[-WhatIfExcludeChangeType <String[]>]
[-ProceedIfNoChange]
[-AsJob]
[-QueryString <String>]
-TemplateParameterFile <String>
-TemplateSpecId <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-Tag <Hashtable>]
[-WhatIfResultFormat <WhatIfResultFormat>]
[-WhatIfExcludeChangeType <String[]>]
[-ProceedIfNoChange]
[-AsJob]
[-QueryString <String>]
-TemplateParameterFile <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-Tag <Hashtable>]
[-WhatIfResultFormat <WhatIfResultFormat>]
[-WhatIfExcludeChangeType <String[]>]
[-ProceedIfNoChange]
[-AsJob]
[-QueryString <String>]
-TemplateParameterUri <String>
-TemplateObject <Hashtable>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-Tag <Hashtable>]
[-WhatIfResultFormat <WhatIfResultFormat>]
[-WhatIfExcludeChangeType <String[]>]
[-ProceedIfNoChange]
[-AsJob]
[-QueryString <String>]
-TemplateParameterUri <String>
-TemplateFile <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-Tag <Hashtable>]
[-WhatIfResultFormat <WhatIfResultFormat>]
[-WhatIfExcludeChangeType <String[]>]
[-ProceedIfNoChange]
[-AsJob]
[-QueryString <String>]
-TemplateParameterUri <String>
-TemplateUri <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-Tag <Hashtable>]
[-WhatIfResultFormat <WhatIfResultFormat>]
[-WhatIfExcludeChangeType <String[]>]
[-ProceedIfNoChange]
[-AsJob]
[-QueryString <String>]
-TemplateParameterUri <String>
-TemplateSpecId <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-Tag <Hashtable>]
[-WhatIfResultFormat <WhatIfResultFormat>]
[-WhatIfExcludeChangeType <String[]>]
[-ProceedIfNoChange]
[-AsJob]
[-QueryString <String>]
-TemplateObject <Hashtable>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-Tag <Hashtable>]
[-WhatIfResultFormat <WhatIfResultFormat>]
[-WhatIfExcludeChangeType <String[]>]
[-ProceedIfNoChange]
[-AsJob]
[-QueryString <String>]
-TemplateUri <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-Tag <Hashtable>]
[-WhatIfResultFormat <WhatIfResultFormat>]
[-WhatIfExcludeChangeType <String[]>]
[-ProceedIfNoChange]
[-AsJob]
[-QueryString <String>]
-TemplateSpecId <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
説明
New-AzDeployment コマンドレットは、現在のサブスクリプション スコープにデプロイを追加します。 これには、デプロイに必要なリソースが含まれます。
Azure リソースは、ユーザーが管理する Azure エンティティです。 リソースは、データベース サーバー、データベース、Web サイト、仮想マシン、ストレージ アカウントなどのリソース グループに格納できます。 または、ロール定義、ポリシー定義などのサブスクリプション レベルのリソースを指定することもできます。
リソース グループにリソースを追加するには、リソース グループにデプロイを 作成する New-AzResourceGroupDeployment を使用します。 New-AzDeployment コマンドレットは、現在のサブスクリプション スコープでデプロイを作成し、サブスクリプション レベルのリソースをデプロイします。
サブスクリプションでデプロイを追加するには、場所とテンプレートを指定します。 この場所は、デプロイ データを格納する場所を Azure Resource Manager に指示します。 テンプレートは、デプロイする個々のリソースを含む JSON 文字列です。 テンプレートには、必要なリソースのパラメーター プレースホルダーと、名前やサイズなどの構成可能なプロパティ値が含まれています。
デプロイにカスタム テンプレートを使用するには、TemplateFile パラメーターまたは TemplateUri パラメーターを指定します。 各テンプレートには、構成可能なプロパティのパラメーターがあります。 テンプレート パラメーターの値を指定するには、TemplateParameterFile パラメーターまたは TemplateParameterObject パラメーターを指定します。 または、テンプレートを指定するときにコマンドに動的に追加されるテンプレート パラメーターを使用することもできます。 動的パラメーターを使用するには、コマンド プロンプトでパラメーターを入力するか、マイナス記号 (-) を入力してパラメーターを指定し、Tab キーを使用して使用可能なパラメーターを循環させます。 コマンド プロンプトで入力したテンプレート パラメーター値は、テンプレート パラメーター オブジェクトまたはテンプレート ファイルの値よりも優先されます。
例
例 1: カスタム テンプレートとパラメーター ファイルを使用してデプロイを作成する
New-AzDeployment -Location "West US" -TemplateFile "D:\Azure\Templates\EngineeringSite.json" -TemplateParameterFile "D:\Azure\Templates\EngSiteParms.json" -Tag @{"key1"="value1"; "key2"="value2";}
このコマンドは、カスタム テンプレートとディスク上のテンプレート ファイルを使用し、タグ パラメーターを定義して、現在のサブスクリプション スコープで新しいデプロイを作成します。 このコマンドでは、TemplateFile パラメーターを使用してテンプレートを指定し、TemplateParameterFile パラメーターを使用して、パラメーターとパラメーター値が含まれるファイルを指定します。
例 2: URI と SAS トークンを使用して、非パブリック ストレージ アカウントに格納されているテンプレートをデプロイする
New-AzDeployment -Location "West US" -TemplateUri "https://example.com/example.json" -QueryString "foo"
このコマンドは、TemplateUri のテンプレートを使用して新しいデプロイを作成します。これにはパブリックではなく、QueryString パラメーターを使用して提供されるアクセスにトークン パラメーターが必要です。
このコマンドを実行すると、URL を使用してテンプレートに効果的にアクセスします https://example.com/example.json?foo
。
これは、SAS トークンを QueryString として指定することで、ストレージ アカウントでテンプレートを使用する場合に使用できます。
例 3: カスタム テンプレート オブジェクトとパラメーター ファイルを使用してデプロイを作成する
$TemplateFileText = [System.IO.File]::ReadAllText("D:\Azure\Templates\EngineeringSite.json")
$TemplateObject = ConvertFrom-Json $TemplateFileText -AsHashtable
New-AzDeployment -Location "West US" -TemplateObject $TemplateObject -TemplateParameterFile "D:\Azure\Templates\EngSiteParams.json"
このコマンドは、カスタム テンプレートと、メモリ内ハッシュテーブルに変換されたディスク上のテンプレート ファイルを使用して、現在のサブスクリプション スコープで新しいデプロイを作成します。 最初の 2 つのコマンドは、ディスク上のテンプレート ファイルのテキストを読み取り、メモリ内ハッシュテーブルに変換します。 最後のコマンドでは、TemplateObject パラメーターを使用してこのハッシュテーブルを指定し、TemplateParameterFile パラメーターを使用して、パラメーターとパラメーター値を含むファイルを指定します。
例 4: .bicepparam ファイルを使用してデプロイを作成する
New-AzDeployment -Location "West US" -TemplateParameterFile "./parameters.bicepparam"
このコマンドは、ディスク上の .bicepparam ファイルを使用して、現在のサブスクリプション スコープに新しいデプロイを作成します。 このコマンドでは、 TemplateParameterFile パラメーターを使用して .bicepparam ファイルを指定します。
パラメーター
-AsJob
バックグラウンドでコマンドレットを実行する
型: | SwitchParameter |
Position: | Named |
既定値: | None |
必須: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Confirm
コマンドレットの実行前に確認を求めるメッセージが表示されます。
型: | SwitchParameter |
Aliases: | cf |
Position: | Named |
既定値: | None |
必須: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultProfile
Azure との通信のために使用される資格情報、アカウント、テナント、サブスクリプションです。
型: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
既定値: | None |
必須: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DeploymentDebugLogLevel
デプロイ デバッグ ログ レベル。
型: | String |
Position: | Named |
既定値: | None |
必須: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Location
デプロイ データを格納する場所。
型: | String |
Position: | Named |
既定値: | None |
必須: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Name
作成するデプロイの名前。 指定しない場合は、テンプレート ファイルが指定されたときに既定でテンプレート ファイル名が使用されます。は、テンプレート オブジェクトが指定された現在の時刻 (例: "20131223140835") に既定で設定されます。
型: | String |
Aliases: | DeploymentName |
Position: | Named |
既定値: | None |
必須: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Pre
設定すると、使用するバージョンを自動的に決定するときに、コマンドレットでプレリリース API バージョンを使用する必要があることを示します。
型: | SwitchParameter |
Position: | Named |
既定値: | None |
必須: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ProceedIfNoChange
What-If の結果に変更がない場合は、確認を求めないでください。 -Confirm スイッチが設定されている場合に適用されます。
型: | SwitchParameter |
Position: | Named |
既定値: | None |
必須: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-QueryString
TemplateUri パラメーターで使用するクエリ文字列 (SAS トークンなど)。 リンクされたテンプレートの場合に使用されます
型: | String |
Position: | Named |
既定値: | None |
必須: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SkipTemplateParameterPrompt
指定されたテンプレート パラメーターにテンプレートで使用されるすべての必要なパラメーターが含まれている場合にチェックする PowerShell 動的パラメーター処理をスキップします。 このチェックは、不足しているパラメーターの値を指定するようにユーザーに求めますが、-SkipTemplateParameterPrompt を指定すると、このプロンプトは無視され、パラメーターがテンプレートにバインドされていないことが見つかった場合は直ちにエラーが発生します。 非対話型スクリプトの場合、-SkipTemplateParameterPrompt を指定すると、すべての必須パラメーターが満たされていない場合に、より適切なエラー メッセージを表示できます。
型: | SwitchParameter |
Position: | Named |
既定値: | None |
必須: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Tag
デプロイに配置するタグ。
型: | Hashtable |
Position: | Named |
既定値: | None |
必須: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-TemplateFile
テンプレート ファイルへのローカル パス。 サポートされているテンプレート ファイルの種類: json と bicep。
型: | String |
Position: | Named |
既定値: | None |
必須: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TemplateObject
テンプレートを表すハッシュ テーブル。
型: | Hashtable |
Position: | Named |
既定値: | None |
必須: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TemplateParameterFile
テンプレートに使用するパラメーター ファイル。
型: | String |
Position: | Named |
既定値: | None |
必須: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TemplateParameterObject
パラメーターを表すハッシュ テーブル。
型: | Hashtable |
Position: | Named |
既定値: | None |
必須: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TemplateParameterUri
テンプレート パラメーター ファイルへの URI。
型: | String |
Position: | Named |
既定値: | None |
必須: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TemplateSpecId
デプロイする templateSpec のリソース ID。
型: | String |
Position: | Named |
既定値: | None |
必須: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TemplateUri
テンプレート ファイルの URI。
型: | String |
Position: | Named |
既定値: | None |
必須: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-WhatIf
コマンドレットの実行時に発生する内容を示します。 このコマンドレットは実行されません。
型: | SwitchParameter |
Aliases: | wi |
Position: | Named |
既定値: | None |
必須: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIfExcludeChangeType
What-If の結果から除外する、コンマ区切りのリソース変更の種類。 WhatIf または -Confirm スイッチが設定されている場合に適用されます。
型: | String[] |
Position: | Named |
既定値: | None |
必須: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIfResultFormat
What-If の結果形式。
型: | WhatIfResultFormat |
承認された値: | ResourceIdOnly, FullResourcePayloads |
Position: | Named |
既定値: | None |
必須: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
入力
出力
Azure PowerShell
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示