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

バックグラウンドでコマンドレットを実行する

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

コマンドレットの実行前に確認を求めるメッセージが表示されます。

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

Azure との通信のために使用される資格情報、アカウント、テナント、サブスクリプションです。

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DeploymentDebugLogLevel

デプロイ デバッグ ログ レベル。

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Location

デプロイ データを格納する場所。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Name

作成するデプロイの名前。 指定しない場合は、テンプレート ファイルが指定されたときに既定でテンプレート ファイル名が使用されます。は、テンプレート オブジェクトが指定された現在の時刻 (例: "20131223140835") に既定で設定されます。

Type:String
Aliases:DeploymentName
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Pre

設定すると、使用するバージョンを自動的に決定するときに、コマンドレットでプレリリース API バージョンを使用する必要があることを示します。

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ProceedIfNoChange

What-If の結果に変更がない場合は、確認を求めないでください。 -Confirm スイッチが設定されている場合に適用されます。

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-QueryString

TemplateUri パラメーターで使用するクエリ文字列 (SAS トークンなど)。 リンクされたテンプレートの場合に使用されます

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SkipTemplateParameterPrompt

指定されたテンプレート パラメーターにテンプレートで使用されるすべての必要なパラメーターが含まれている場合にチェックする PowerShell 動的パラメーター処理をスキップします。 このチェックは、不足しているパラメーターの値を指定するようにユーザーに求めますが、-SkipTemplateParameterPrompt を指定すると、このプロンプトは無視され、パラメーターがテンプレートにバインドされていないことが見つかった場合は直ちにエラーが発生します。 非対話型スクリプトの場合、-SkipTemplateParameterPrompt を指定すると、すべての必須パラメーターが満たされていない場合に、より適切なエラー メッセージを表示できます。

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Tag

デプロイに配置するタグ。

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TemplateFile

テンプレート ファイルへのローカル パス。 サポートされているテンプレート ファイルの種類: json と bicep。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TemplateObject

テンプレートを表すハッシュ テーブル。

Type:Hashtable
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TemplateParameterFile

テンプレートに使用するパラメーター ファイル。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TemplateParameterObject

パラメーターを表すハッシュ テーブル。

Type:Hashtable
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TemplateParameterUri

テンプレート パラメーター ファイルへの URI。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TemplateSpecId

デプロイする templateSpec のリソース ID。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TemplateUri

テンプレート ファイルの URI。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

コマンドレットの実行時に発生する内容を示します。 このコマンドレットは実行されません。

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIfExcludeChangeType

What-If の結果から除外する、コンマ区切りのリソース変更の種類。 WhatIf または -Confirm スイッチが設定されている場合に適用されます。

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIfResultFormat

What-If の結果形式。

Type:WhatIfResultFormat
Accepted values:ResourceIdOnly, FullResourcePayloads
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

入力

Hashtable

String

出力

PSDeployment