將資源部署至資源群組。
您可以直接在要求中提供範本和參數,或連結至 JSON 檔案。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}?api-version=2025-04-01
URI 參數
| 名稱 |
位於 |
必要 |
類型 |
Description |
|
deploymentName
|
path |
True
|
string
minLength: 1 maxLength: 64 pattern: ^[-\w\._\(\)]+$
|
部署的名稱。
|
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90 pattern: ^[-\w\._\(\)]+$
|
要部署資源的資源群組名稱。 名稱不區分大小寫。 資源群組必須已存在。
|
|
subscriptionId
|
path |
True
|
string
|
Microsoft Azure 訂用帳戶標識碼。
|
|
api-version
|
query |
True
|
string
|
要用於這項作業的 API 版本。
|
要求本文
回應
安全性
azure_auth
Azure Active Directory OAuth2 流
類型:
oauth2
Flow:
implicit
授權 URL:
https://login.microsoftonline.com/common/oauth2/authorize
範圍
| 名稱 |
Description |
|
user_impersonation
|
模擬您的用戶帳戶
|
範例
Create a deployment that will deploy a template with a uri and queryString
範例要求
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000001/resourcegroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment?api-version=2025-04-01
{
"properties": {
"templateLink": {
"uri": "https://example.com/exampleTemplate.json",
"queryString": "sv=2019-02-02&st=2019-04-29T22%3A18%3A26Z&se=2019-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=xxxxxxxx0xxxxxxxxxxxxx%2bxxxxxxxxxxxxxxxxxxxx%3d"
},
"parameters": {},
"mode": "Incremental"
}
}
import com.azure.resourcemanager.resources.fluent.models.DeploymentInner;
import com.azure.resourcemanager.resources.models.DeploymentMode;
import com.azure.resourcemanager.resources.models.DeploymentProperties;
import com.azure.resourcemanager.resources.models.TemplateLink;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Deployments CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/
* PutDeploymentResourceGroup.json
*/
/**
* Sample code: Create a deployment that will deploy a template with a uri and queryString.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createADeploymentThatWillDeployATemplateWithAUriAndQueryString(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.genericResources().manager().deploymentClient().getDeployments().createOrUpdate("my-resource-group",
"my-deployment",
new DeploymentInner().withProperties(new DeploymentProperties().withTemplateLink(
new TemplateLink().withUri("https://example.com/exampleTemplate.json").withQueryString(
"sv=2019-02-02&st=2019-04-29T22%3A18%3A26Z&se=2019-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=xxxxxxxx0xxxxxxxxxxxxx%2bxxxxxxxxxxxxxxxxxxxx%3d"))
.withParameters(mapOf()).withMode(DeploymentMode.INCREMENTAL)),
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.resource.deployments import DeploymentsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-resource-deployments
# USAGE
python put_deployment_resource_group.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = DeploymentsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000001",
)
response = client.deployments.begin_create_or_update(
resource_group_name="my-resource-group",
deployment_name="my-deployment",
parameters={
"properties": {
"mode": "Incremental",
"parameters": {},
"templateLink": {
"queryString": "sv=2019-02-02&st=2019-04-29T22%3A18%3A26Z&se=2019-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=xxxxxxxx0xxxxxxxxxxxxx%2bxxxxxxxxxxxxxxxxxxxx%3d",
"uri": "https://example.com/exampleTemplate.json",
},
}
},
).result()
print(response)
# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PutDeploymentResourceGroup.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armdeployments_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armdeployments"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edacc3b43f9603efa119eabb6013d952d1dbe7d6/specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PutDeploymentResourceGroup.json
func ExampleClient_BeginCreateOrUpdate_createADeploymentThatWillDeployATemplateWithAUriAndQueryString() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdeployments.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClient().BeginCreateOrUpdate(ctx, "my-resource-group", "my-deployment", armdeployments.Deployment{
Properties: &armdeployments.DeploymentProperties{
Mode: to.Ptr(armdeployments.DeploymentModeIncremental),
Parameters: map[string]*armdeployments.DeploymentParameter{},
TemplateLink: &armdeployments.TemplateLink{
QueryString: to.Ptr("sv=2019-02-02&st=2019-04-29T22%3A18%3A26Z&se=2019-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=xxxxxxxx0xxxxxxxxxxxxx%2bxxxxxxxxxxxxxxxxxxxx%3d"),
URI: to.Ptr("https://example.com/exampleTemplate.json"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.DeploymentExtended = armdeployments.DeploymentExtended{
// Name: to.Ptr("my-deployment"),
// Type: to.Ptr("Microsoft.Resources/deployments"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment"),
// Properties: &armdeployments.DeploymentPropertiesExtended{
// CorrelationID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// Dependencies: []*armdeployments.Dependency{
// },
// Duration: to.Ptr("PT22.8356799S"),
// Mode: to.Ptr(armdeployments.DeploymentModeIncremental),
// OutputResources: []*armdeployments.ResourceReference{
// {
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Storage/storageAccounts/my-storage-account"),
// }},
// Parameters: map[string]any{
// },
// Providers: []*armdeployments.Provider{
// {
// Namespace: to.Ptr("Microsoft.Storage"),
// ResourceTypes: []*armdeployments.ProviderResourceType{
// {
// Locations: []*string{
// to.Ptr("eastus")},
// ResourceType: to.Ptr("storageAccounts"),
// }},
// }},
// ProvisioningState: to.Ptr(armdeployments.ProvisioningStateSucceeded),
// TemplateHash: to.Ptr("0000000000000000000"),
// TemplateLink: &armdeployments.TemplateLink{
// ContentVersion: to.Ptr("1.0.0.0"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/TemplateSpecs/TemplateSpec-Name/versions/v1"),
// },
// Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-05T01:20:01.723Z"); return t}()),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { DeploymentsClient } = require("@azure/arm-resourcesdeployments");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to You can provide the template and parameters directly in the request or link to JSON files.
*
* @summary You can provide the template and parameters directly in the request or link to JSON files.
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PutDeploymentResourceGroup.json
*/
async function createADeploymentThatWillDeployATemplateWithAUriAndQueryString() {
const subscriptionId =
process.env["RESOURCES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000001";
const resourceGroupName = process.env["RESOURCES_RESOURCE_GROUP"] || "my-resource-group";
const deploymentName = "my-deployment";
const parameters = {
properties: {
mode: "Incremental",
parameters: {},
templateLink: {
queryString:
"sv=2019-02-02&st=2019-04-29T22%3A18%3A26Z&se=2019-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=xxxxxxxx0xxxxxxxxxxxxx%2bxxxxxxxxxxxxxxxxxxxx%3d",
uri: "https://example.com/exampleTemplate.json",
},
},
};
const credential = new DefaultAzureCredential();
const client = new DeploymentsClient(credential, subscriptionId);
const result = await client.deployments.beginCreateOrUpdateAndWait(
resourceGroupName,
deploymentName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment",
"name": "my-deployment",
"type": "Microsoft.Resources/deployments",
"properties": {
"templateLink": {
"id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/TemplateSpecs/TemplateSpec-Name/versions/v1",
"contentVersion": "1.0.0.0"
},
"templateHash": "0000000000000000000",
"parameters": {},
"mode": "Incremental",
"provisioningState": "Succeeded",
"timestamp": "2020-06-05T01:20:01.723776Z",
"duration": "PT22.8356799S",
"correlationId": "00000000-0000-0000-0000-000000000000",
"providers": [
{
"namespace": "Microsoft.Storage",
"resourceTypes": [
{
"resourceType": "storageAccounts",
"locations": [
"eastus"
]
}
]
}
],
"dependencies": [],
"outputResources": [
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Storage/storageAccounts/my-storage-account"
}
]
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment",
"name": "my-deployment",
"type": "Microsoft.Resources/deployments",
"properties": {
"templateLink": {
"id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/TemplateSpecs/TemplateSpec-Name/versions/v1",
"contentVersion": "1.0.0.0"
},
"templateHash": "0000000000000000000",
"parameters": {},
"mode": "Incremental",
"provisioningState": "Accepted",
"timestamp": "2020-06-05T01:20:01.723776Z",
"duration": "PT22.8356799S",
"correlationId": "00000000-0000-0000-0000-000000000000",
"providers": [
{
"namespace": "Microsoft.Storage",
"resourceTypes": [
{
"resourceType": "storageAccounts",
"locations": [
"eastus"
]
}
]
}
],
"dependencies": []
}
}
Create a deployment that will deploy a templateSpec with the given resourceId
範例要求
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000001/resourcegroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment?api-version=2025-04-01
{
"properties": {
"templateLink": {
"id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/TemplateSpecs/TemplateSpec-Name/versions/v1"
},
"parameters": {},
"mode": "Incremental"
}
}
import com.azure.resourcemanager.resources.fluent.models.DeploymentInner;
import com.azure.resourcemanager.resources.models.DeploymentMode;
import com.azure.resourcemanager.resources.models.DeploymentProperties;
import com.azure.resourcemanager.resources.models.TemplateLink;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Deployments CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/
* PutDeploymentResourceGroupTemplateSpecsWithId.json
*/
/**
* Sample code: Create a deployment that will deploy a templateSpec with the given resourceId.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createADeploymentThatWillDeployATemplateSpecWithTheGivenResourceId(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.genericResources().manager().deploymentClient().getDeployments().createOrUpdate("my-resource-group",
"my-deployment",
new DeploymentInner().withProperties(new DeploymentProperties().withTemplateLink(new TemplateLink().withId(
"/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/TemplateSpecs/TemplateSpec-Name/versions/v1"))
.withParameters(mapOf()).withMode(DeploymentMode.INCREMENTAL)),
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.resource.deployments import DeploymentsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-resource-deployments
# USAGE
python put_deployment_resource_group_template_specs_with_id.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = DeploymentsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000001",
)
response = client.deployments.begin_create_or_update(
resource_group_name="my-resource-group",
deployment_name="my-deployment",
parameters={
"properties": {
"mode": "Incremental",
"parameters": {},
"templateLink": {
"id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/TemplateSpecs/TemplateSpec-Name/versions/v1"
},
}
},
).result()
print(response)
# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PutDeploymentResourceGroupTemplateSpecsWithId.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armdeployments_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armdeployments"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edacc3b43f9603efa119eabb6013d952d1dbe7d6/specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PutDeploymentResourceGroupTemplateSpecsWithId.json
func ExampleClient_BeginCreateOrUpdate_createADeploymentThatWillDeployATemplateSpecWithTheGivenResourceId() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdeployments.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClient().BeginCreateOrUpdate(ctx, "my-resource-group", "my-deployment", armdeployments.Deployment{
Properties: &armdeployments.DeploymentProperties{
Mode: to.Ptr(armdeployments.DeploymentModeIncremental),
Parameters: map[string]*armdeployments.DeploymentParameter{},
TemplateLink: &armdeployments.TemplateLink{
ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/TemplateSpecs/TemplateSpec-Name/versions/v1"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.DeploymentExtended = armdeployments.DeploymentExtended{
// Name: to.Ptr("my-deployment"),
// Type: to.Ptr("Microsoft.Resources/deployments"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment"),
// Properties: &armdeployments.DeploymentPropertiesExtended{
// CorrelationID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// Dependencies: []*armdeployments.Dependency{
// },
// Duration: to.Ptr("PT22.8356799S"),
// Mode: to.Ptr(armdeployments.DeploymentModeIncremental),
// OutputResources: []*armdeployments.ResourceReference{
// {
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Storage/storageAccounts/my-storage-account"),
// }},
// Parameters: map[string]any{
// },
// Providers: []*armdeployments.Provider{
// {
// Namespace: to.Ptr("Microsoft.Storage"),
// ResourceTypes: []*armdeployments.ProviderResourceType{
// {
// Locations: []*string{
// to.Ptr("eastus")},
// ResourceType: to.Ptr("storageAccounts"),
// }},
// }},
// ProvisioningState: to.Ptr(armdeployments.ProvisioningStateSucceeded),
// TemplateHash: to.Ptr("0000000000000000000"),
// TemplateLink: &armdeployments.TemplateLink{
// ContentVersion: to.Ptr("1.0.0.0"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/TemplateSpecs/TemplateSpec-Name/versions/v1"),
// },
// Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-05T01:20:01.723Z"); return t}()),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { DeploymentsClient } = require("@azure/arm-resourcesdeployments");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to You can provide the template and parameters directly in the request or link to JSON files.
*
* @summary You can provide the template and parameters directly in the request or link to JSON files.
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PutDeploymentResourceGroupTemplateSpecsWithId.json
*/
async function createADeploymentThatWillDeployATemplateSpecWithTheGivenResourceId() {
const subscriptionId =
process.env["RESOURCES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000001";
const resourceGroupName = process.env["RESOURCES_RESOURCE_GROUP"] || "my-resource-group";
const deploymentName = "my-deployment";
const parameters = {
properties: {
mode: "Incremental",
parameters: {},
templateLink: {
id: "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/TemplateSpecs/TemplateSpec-Name/versions/v1",
},
},
};
const credential = new DefaultAzureCredential();
const client = new DeploymentsClient(credential, subscriptionId);
const result = await client.deployments.beginCreateOrUpdateAndWait(
resourceGroupName,
deploymentName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment",
"name": "my-deployment",
"type": "Microsoft.Resources/deployments",
"properties": {
"templateLink": {
"id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/TemplateSpecs/TemplateSpec-Name/versions/v1",
"contentVersion": "1.0.0.0"
},
"templateHash": "0000000000000000000",
"parameters": {},
"mode": "Incremental",
"provisioningState": "Succeeded",
"timestamp": "2020-06-05T01:20:01.723776Z",
"duration": "PT22.8356799S",
"correlationId": "00000000-0000-0000-0000-000000000000",
"providers": [
{
"namespace": "Microsoft.Storage",
"resourceTypes": [
{
"resourceType": "storageAccounts",
"locations": [
"eastus"
]
}
]
}
],
"dependencies": [],
"outputResources": [
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Storage/storageAccounts/my-storage-account"
}
]
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment",
"name": "my-deployment",
"type": "Microsoft.Resources/deployments",
"properties": {
"templateLink": {
"id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/TemplateSpecs/TemplateSpec-Name/versions/v1",
"contentVersion": "1.0.0.0"
},
"templateHash": "0000000000000000000",
"parameters": {},
"mode": "Incremental",
"provisioningState": "Accepted",
"timestamp": "2020-06-05T01:20:01.723776Z",
"duration": "PT22.8356799S",
"correlationId": "00000000-0000-0000-0000-000000000000",
"providers": [
{
"namespace": "Microsoft.Storage",
"resourceTypes": [
{
"resourceType": "storageAccounts",
"locations": [
"eastus"
]
}
]
}
],
"dependencies": []
}
}
Create a deployment that will redeploy another deployment on failure
範例要求
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment?api-version=2025-04-01
{
"properties": {
"templateLink": {
"uri": "https://example.com/exampleTemplate.json"
},
"parameters": {},
"mode": "Complete",
"onErrorDeployment": {
"type": "SpecificDeployment",
"deploymentName": "name-of-deployment-to-use"
}
}
}
import com.azure.resourcemanager.resources.fluent.models.DeploymentInner;
import com.azure.resourcemanager.resources.models.DeploymentMode;
import com.azure.resourcemanager.resources.models.DeploymentProperties;
import com.azure.resourcemanager.resources.models.OnErrorDeployment;
import com.azure.resourcemanager.resources.models.OnErrorDeploymentType;
import com.azure.resourcemanager.resources.models.TemplateLink;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Deployments CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/
* PutDeploymentWithOnErrorDeploymentSpecificDeployment.json
*/
/**
* Sample code: Create a deployment that will redeploy another deployment on failure.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createADeploymentThatWillRedeployAnotherDeploymentOnFailure(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.genericResources().manager().deploymentClient().getDeployments().createOrUpdate("my-resource-group",
"my-deployment",
new DeploymentInner().withProperties(new DeploymentProperties()
.withTemplateLink(new TemplateLink().withUri("https://example.com/exampleTemplate.json"))
.withParameters(mapOf()).withMode(DeploymentMode.COMPLETE)
.withOnErrorDeployment(new OnErrorDeployment().withType(OnErrorDeploymentType.SPECIFIC_DEPLOYMENT)
.withDeploymentName("name-of-deployment-to-use"))),
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.resource.deployments import DeploymentsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-resource-deployments
# USAGE
python put_deployment_with_on_error_deployment_specific_deployment.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = DeploymentsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.deployments.begin_create_or_update(
resource_group_name="my-resource-group",
deployment_name="my-deployment",
parameters={
"properties": {
"mode": "Complete",
"onErrorDeployment": {"deploymentName": "name-of-deployment-to-use", "type": "SpecificDeployment"},
"parameters": {},
"templateLink": {"uri": "https://example.com/exampleTemplate.json"},
}
},
).result()
print(response)
# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PutDeploymentWithOnErrorDeploymentSpecificDeployment.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armdeployments_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armdeployments"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edacc3b43f9603efa119eabb6013d952d1dbe7d6/specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PutDeploymentWithOnErrorDeploymentSpecificDeployment.json
func ExampleClient_BeginCreateOrUpdate_createADeploymentThatWillRedeployAnotherDeploymentOnFailure() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdeployments.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClient().BeginCreateOrUpdate(ctx, "my-resource-group", "my-deployment", armdeployments.Deployment{
Properties: &armdeployments.DeploymentProperties{
Mode: to.Ptr(armdeployments.DeploymentModeComplete),
OnErrorDeployment: &armdeployments.OnErrorDeployment{
Type: to.Ptr(armdeployments.OnErrorDeploymentTypeSpecificDeployment),
DeploymentName: to.Ptr("name-of-deployment-to-use"),
},
Parameters: map[string]*armdeployments.DeploymentParameter{},
TemplateLink: &armdeployments.TemplateLink{
URI: to.Ptr("https://example.com/exampleTemplate.json"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.DeploymentExtended = armdeployments.DeploymentExtended{
// Name: to.Ptr("my-deployment"),
// Type: to.Ptr("Microsoft.Resources/deployments"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment"),
// Properties: &armdeployments.DeploymentPropertiesExtended{
// CorrelationID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// Dependencies: []*armdeployments.Dependency{
// {
// DependsOn: []*armdeployments.BasicDependency{
// {
// ID: to.Ptr("{resourceid}"),
// ResourceName: to.Ptr("VNet1"),
// ResourceType: to.Ptr("Microsoft.Network/virtualNetworks"),
// }},
// ID: to.Ptr("{resourceid}"),
// ResourceName: to.Ptr("VNet1/Subnet1"),
// ResourceType: to.Ptr("Microsoft.Network/virtualNetworks/subnets"),
// },
// {
// DependsOn: []*armdeployments.BasicDependency{
// {
// ID: to.Ptr("{resourceid}"),
// ResourceName: to.Ptr("VNet1"),
// ResourceType: to.Ptr("Microsoft.Network/virtualNetworks"),
// },
// {
// ID: to.Ptr("{resourceid}"),
// ResourceName: to.Ptr("VNet1/Subnet1"),
// ResourceType: to.Ptr("Microsoft.Network/virtualNetworks/subnets"),
// }},
// ID: to.Ptr("{resourceid}"),
// ResourceName: to.Ptr("VNet1/Subnet2"),
// ResourceType: to.Ptr("Microsoft.Network/virtualNetworks/subnets"),
// }},
// Duration: to.Ptr("PT0.8204881S"),
// Mode: to.Ptr(armdeployments.DeploymentModeComplete),
// OnErrorDeployment: &armdeployments.OnErrorDeploymentExtended{
// Type: to.Ptr(armdeployments.OnErrorDeploymentTypeSpecificDeployment),
// DeploymentName: to.Ptr("name-of-deployment-to-use"),
// },
// Parameters: map[string]any{
// },
// Providers: []*armdeployments.Provider{
// {
// Namespace: to.Ptr("Microsoft.Network"),
// ResourceTypes: []*armdeployments.ProviderResourceType{
// {
// Locations: []*string{
// to.Ptr("centralus")},
// ResourceType: to.Ptr("virtualNetworks"),
// },
// {
// Locations: []*string{
// to.Ptr("centralus")},
// ResourceType: to.Ptr("virtualNetworks/subnets"),
// }},
// }},
// ProvisioningState: to.Ptr(armdeployments.ProvisioningStateSucceeded),
// TemplateLink: &armdeployments.TemplateLink{
// ContentVersion: to.Ptr("1.0.0.0"),
// URI: to.Ptr("https://example.com/exampleTemplate.json"),
// },
// Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.000Z"); return t}()),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { DeploymentsClient } = require("@azure/arm-resourcesdeployments");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to You can provide the template and parameters directly in the request or link to JSON files.
*
* @summary You can provide the template and parameters directly in the request or link to JSON files.
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PutDeploymentWithOnErrorDeploymentSpecificDeployment.json
*/
async function createADeploymentThatWillRedeployAnotherDeploymentOnFailure() {
const subscriptionId =
process.env["RESOURCES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["RESOURCES_RESOURCE_GROUP"] || "my-resource-group";
const deploymentName = "my-deployment";
const parameters = {
properties: {
mode: "Complete",
onErrorDeployment: {
type: "SpecificDeployment",
deploymentName: "name-of-deployment-to-use",
},
parameters: {},
templateLink: { uri: "https://example.com/exampleTemplate.json" },
},
};
const credential = new DefaultAzureCredential();
const client = new DeploymentsClient(credential, subscriptionId);
const result = await client.deployments.beginCreateOrUpdateAndWait(
resourceGroupName,
deploymentName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment",
"name": "my-deployment",
"type": "Microsoft.Resources/deployments",
"properties": {
"templateLink": {
"uri": "https://example.com/exampleTemplate.json",
"contentVersion": "1.0.0.0"
},
"parameters": {},
"mode": "Complete",
"provisioningState": "Accepted",
"timestamp": "2019-03-01T00:00:00.0000000Z",
"duration": "PT0.8204881S",
"correlationId": "00000000-0000-0000-0000-000000000000",
"providers": [
{
"namespace": "Microsoft.Network",
"resourceTypes": [
{
"resourceType": "virtualNetworks",
"locations": [
"centralus"
]
},
{
"resourceType": "virtualNetworks/subnets",
"locations": [
"centralus"
]
}
]
}
],
"dependencies": [
{
"dependsOn": [
{
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks",
"resourceName": "VNet1"
}
],
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks/subnets",
"resourceName": "VNet1/Subnet1"
},
{
"dependsOn": [
{
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks",
"resourceName": "VNet1"
},
{
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks/subnets",
"resourceName": "VNet1/Subnet1"
}
],
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks/subnets",
"resourceName": "VNet1/Subnet2"
}
],
"onErrorDeployment": {
"type": "SpecificDeployment",
"deploymentName": "name-of-deployment-to-use"
}
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment",
"name": "my-deployment",
"type": "Microsoft.Resources/deployments",
"properties": {
"templateLink": {
"uri": "https://example.com/exampleTemplate.json",
"contentVersion": "1.0.0.0"
},
"parameters": {},
"mode": "Complete",
"provisioningState": "Accepted",
"timestamp": "2019-03-01T00:00:00.0000000Z",
"duration": "PT0.8204881S",
"correlationId": "00000000-0000-0000-0000-000000000000",
"providers": [
{
"namespace": "Microsoft.Network",
"resourceTypes": [
{
"resourceType": "virtualNetworks",
"locations": [
"centralus"
]
},
{
"resourceType": "virtualNetworks/subnets",
"locations": [
"centralus"
]
}
]
}
],
"dependencies": [
{
"dependsOn": [
{
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks",
"resourceName": "VNet1"
}
],
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks/subnets",
"resourceName": "VNet1/Subnet1"
},
{
"dependsOn": [
{
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks",
"resourceName": "VNet1"
},
{
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks/subnets",
"resourceName": "VNet1/Subnet1"
}
],
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks/subnets",
"resourceName": "VNet1/Subnet2"
}
],
"onErrorDeployment": {
"type": "SpecificDeployment",
"deploymentName": "name-of-deployment-to-use"
}
}
}
Create a deployment that will redeploy the last successful deployment on failure
範例要求
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment?api-version=2025-04-01
{
"properties": {
"templateLink": {
"uri": "https://example.com/exampleTemplate.json"
},
"parameters": {},
"mode": "Complete",
"onErrorDeployment": {
"type": "LastSuccessful"
}
}
}
import com.azure.resourcemanager.resources.fluent.models.DeploymentInner;
import com.azure.resourcemanager.resources.models.DeploymentMode;
import com.azure.resourcemanager.resources.models.DeploymentProperties;
import com.azure.resourcemanager.resources.models.OnErrorDeployment;
import com.azure.resourcemanager.resources.models.OnErrorDeploymentType;
import com.azure.resourcemanager.resources.models.TemplateLink;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Deployments CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/
* PutDeploymentWithOnErrorDeploymentLastSuccessful.json
*/
/**
* Sample code: Create a deployment that will redeploy the last successful deployment on failure.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createADeploymentThatWillRedeployTheLastSuccessfulDeploymentOnFailure(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.genericResources().manager().deploymentClient().getDeployments().createOrUpdate("my-resource-group",
"my-deployment",
new DeploymentInner().withProperties(new DeploymentProperties()
.withTemplateLink(new TemplateLink().withUri("https://example.com/exampleTemplate.json"))
.withParameters(mapOf()).withMode(DeploymentMode.COMPLETE)
.withOnErrorDeployment(new OnErrorDeployment().withType(OnErrorDeploymentType.LAST_SUCCESSFUL))),
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.resource.deployments import DeploymentsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-resource-deployments
# USAGE
python put_deployment_with_on_error_deployment_last_successful.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = DeploymentsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.deployments.begin_create_or_update(
resource_group_name="my-resource-group",
deployment_name="my-deployment",
parameters={
"properties": {
"mode": "Complete",
"onErrorDeployment": {"type": "LastSuccessful"},
"parameters": {},
"templateLink": {"uri": "https://example.com/exampleTemplate.json"},
}
},
).result()
print(response)
# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PutDeploymentWithOnErrorDeploymentLastSuccessful.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armdeployments_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armdeployments"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edacc3b43f9603efa119eabb6013d952d1dbe7d6/specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PutDeploymentWithOnErrorDeploymentLastSuccessful.json
func ExampleClient_BeginCreateOrUpdate_createADeploymentThatWillRedeployTheLastSuccessfulDeploymentOnFailure() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdeployments.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClient().BeginCreateOrUpdate(ctx, "my-resource-group", "my-deployment", armdeployments.Deployment{
Properties: &armdeployments.DeploymentProperties{
Mode: to.Ptr(armdeployments.DeploymentModeComplete),
OnErrorDeployment: &armdeployments.OnErrorDeployment{
Type: to.Ptr(armdeployments.OnErrorDeploymentTypeLastSuccessful),
},
Parameters: map[string]*armdeployments.DeploymentParameter{},
TemplateLink: &armdeployments.TemplateLink{
URI: to.Ptr("https://example.com/exampleTemplate.json"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.DeploymentExtended = armdeployments.DeploymentExtended{
// Name: to.Ptr("my-deployment"),
// Type: to.Ptr("Microsoft.Resources/deployments"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment"),
// Properties: &armdeployments.DeploymentPropertiesExtended{
// CorrelationID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// Dependencies: []*armdeployments.Dependency{
// {
// DependsOn: []*armdeployments.BasicDependency{
// {
// ID: to.Ptr("{resourceid}"),
// ResourceName: to.Ptr("VNet1"),
// ResourceType: to.Ptr("Microsoft.Network/virtualNetworks"),
// }},
// ID: to.Ptr("{resourceid}"),
// ResourceName: to.Ptr("VNet1/Subnet1"),
// ResourceType: to.Ptr("Microsoft.Network/virtualNetworks/subnets"),
// },
// {
// DependsOn: []*armdeployments.BasicDependency{
// {
// ID: to.Ptr("{resourceid}"),
// ResourceName: to.Ptr("VNet1"),
// ResourceType: to.Ptr("Microsoft.Network/virtualNetworks"),
// },
// {
// ID: to.Ptr("{resourceid}"),
// ResourceName: to.Ptr("VNet1/Subnet1"),
// ResourceType: to.Ptr("Microsoft.Network/virtualNetworks/subnets"),
// }},
// ID: to.Ptr("{resourceid}"),
// ResourceName: to.Ptr("VNet1/Subnet2"),
// ResourceType: to.Ptr("Microsoft.Network/virtualNetworks/subnets"),
// }},
// Duration: to.Ptr("PT0.8204881S"),
// Mode: to.Ptr(armdeployments.DeploymentModeComplete),
// OnErrorDeployment: &armdeployments.OnErrorDeploymentExtended{
// Type: to.Ptr(armdeployments.OnErrorDeploymentTypeLastSuccessful),
// DeploymentName: to.Ptr("{nameOfLastSuccesfulDeployment}"),
// },
// Parameters: map[string]any{
// },
// Providers: []*armdeployments.Provider{
// {
// Namespace: to.Ptr("Microsoft.Network"),
// ResourceTypes: []*armdeployments.ProviderResourceType{
// {
// Locations: []*string{
// to.Ptr("centralus")},
// ResourceType: to.Ptr("virtualNetworks"),
// },
// {
// Locations: []*string{
// to.Ptr("centralus")},
// ResourceType: to.Ptr("virtualNetworks/subnets"),
// }},
// }},
// ProvisioningState: to.Ptr(armdeployments.ProvisioningStateSucceeded),
// TemplateLink: &armdeployments.TemplateLink{
// ContentVersion: to.Ptr("1.0.0.0"),
// URI: to.Ptr("https://example.com/exampleTemplate.json"),
// },
// Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.000Z"); return t}()),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { DeploymentsClient } = require("@azure/arm-resourcesdeployments");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to You can provide the template and parameters directly in the request or link to JSON files.
*
* @summary You can provide the template and parameters directly in the request or link to JSON files.
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PutDeploymentWithOnErrorDeploymentLastSuccessful.json
*/
async function createADeploymentThatWillRedeployTheLastSuccessfulDeploymentOnFailure() {
const subscriptionId =
process.env["RESOURCES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["RESOURCES_RESOURCE_GROUP"] || "my-resource-group";
const deploymentName = "my-deployment";
const parameters = {
properties: {
mode: "Complete",
onErrorDeployment: { type: "LastSuccessful" },
parameters: {},
templateLink: { uri: "https://example.com/exampleTemplate.json" },
},
};
const credential = new DefaultAzureCredential();
const client = new DeploymentsClient(credential, subscriptionId);
const result = await client.deployments.beginCreateOrUpdateAndWait(
resourceGroupName,
deploymentName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment",
"name": "my-deployment",
"type": "Microsoft.Resources/deployments",
"properties": {
"templateLink": {
"uri": "https://example.com/exampleTemplate.json",
"contentVersion": "1.0.0.0"
},
"parameters": {},
"mode": "Complete",
"provisioningState": "Accepted",
"timestamp": "2019-03-01T00:00:00.0000000Z",
"duration": "PT0.8204881S",
"correlationId": "00000000-0000-0000-0000-000000000000",
"providers": [
{
"namespace": "Microsoft.Network",
"resourceTypes": [
{
"resourceType": "virtualNetworks",
"locations": [
"centralus"
]
},
{
"resourceType": "virtualNetworks/subnets",
"locations": [
"centralus"
]
}
]
}
],
"dependencies": [
{
"dependsOn": [
{
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks",
"resourceName": "VNet1"
}
],
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks/subnets",
"resourceName": "VNet1/Subnet1"
},
{
"dependsOn": [
{
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks",
"resourceName": "VNet1"
},
{
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks/subnets",
"resourceName": "VNet1/Subnet1"
}
],
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks/subnets",
"resourceName": "VNet1/Subnet2"
}
],
"onErrorDeployment": {
"type": "LastSuccessful",
"deploymentName": "{nameOfLastSuccesfulDeployment}"
}
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment",
"name": "my-deployment",
"type": "Microsoft.Resources/deployments",
"properties": {
"templateLink": {
"uri": "https://example.com/exampleTemplate.json",
"contentVersion": "1.0.0.0"
},
"parameters": {},
"mode": "Complete",
"provisioningState": "Accepted",
"timestamp": "2019-03-01T00:00:00.0000000Z",
"duration": "PT0.8204881S",
"correlationId": "00000000-0000-0000-0000-000000000000",
"providers": [
{
"namespace": "Microsoft.Network",
"resourceTypes": [
{
"resourceType": "virtualNetworks",
"locations": [
"centralus"
]
},
{
"resourceType": "virtualNetworks/subnets",
"locations": [
"centralus"
]
}
]
}
],
"dependencies": [
{
"dependsOn": [
{
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks",
"resourceName": "VNet1"
}
],
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks/subnets",
"resourceName": "VNet1/Subnet1"
},
{
"dependsOn": [
{
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks",
"resourceName": "VNet1"
},
{
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks/subnets",
"resourceName": "VNet1/Subnet1"
}
],
"id": "{resourceid}",
"resourceType": "Microsoft.Network/virtualNetworks/subnets",
"resourceName": "VNet1/Subnet2"
}
],
"onErrorDeployment": {
"type": "LastSuccessful",
"deploymentName": "{nameOfLastSuccesfulDeployment}"
}
}
}
範例要求
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000001/resourcegroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment?api-version=2025-04-01
{
"properties": {
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"inputObj": {
"type": "object"
}
},
"resources": [],
"outputs": {
"inputObj": {
"type": "object",
"value": "[parameters('inputObj')]"
}
}
},
"parameters": {
"inputObj": {
"expression": "[createObject('foo', externalInputs('fooValue'))]"
}
},
"externalInputDefinitions": {
"fooValue": {
"kind": "sys.envVar",
"config": "FOO_VALUE"
}
},
"externalInputs": {
"fooValue": {
"value": "baz"
}
},
"mode": "Incremental"
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.resources.fluent.models.DeploymentInner;
import com.azure.resourcemanager.resources.models.DeploymentExternalInput;
import com.azure.resourcemanager.resources.models.DeploymentExternalInputDefinition;
import com.azure.resourcemanager.resources.models.DeploymentMode;
import com.azure.resourcemanager.resources.models.DeploymentParameter;
import com.azure.resourcemanager.resources.models.DeploymentProperties;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Deployments CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/
* PutDeploymentWithExternalInputs.json
*/
/**
* Sample code: Create deployment using external inputs.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createDeploymentUsingExternalInputs(com.azure.resourcemanager.AzureResourceManager azure)
throws IOException {
azure.genericResources().manager().deploymentClient().getDeployments().createOrUpdate("my-resource-group",
"my-deployment",
new DeploymentInner().withProperties(new DeploymentProperties()
.withTemplate(SerializerFactory.createDefaultManagementSerializerAdapter().deserialize(
"{\"$schema\":\"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#\",\"contentVersion\":\"1.0.0.0\",\"outputs\":{\"inputObj\":{\"type\":\"object\",\"value\":\"[parameters('inputObj')]\"}},\"parameters\":{\"inputObj\":{\"type\":\"object\"}},\"resources\":[]}",
Object.class, SerializerEncoding.JSON))
.withParameters(mapOf("inputObj",
new DeploymentParameter().withExpression("[createObject('foo', externalInputs('fooValue'))]")))
.withExternalInputs(mapOf("fooValue", new DeploymentExternalInput().withValue("baz")))
.withExternalInputDefinitions(mapOf("fooValue",
new DeploymentExternalInputDefinition().withKind("sys.envVar").withConfig("FOO_VALUE")))
.withMode(DeploymentMode.INCREMENTAL)),
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.resource.deployments import DeploymentsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-resource-deployments
# USAGE
python put_deployment_with_external_inputs.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = DeploymentsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000001",
)
response = client.deployments.begin_create_or_update(
resource_group_name="my-resource-group",
deployment_name="my-deployment",
parameters={
"properties": {
"externalInputDefinitions": {"fooValue": {"config": "FOO_VALUE", "kind": "sys.envVar"}},
"externalInputs": {"fooValue": {"value": "baz"}},
"mode": "Incremental",
"parameters": {"inputObj": {"expression": "[createObject('foo', externalInputs('fooValue'))]"}},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"outputs": {"inputObj": {"type": "object", "value": "[parameters('inputObj')]"}},
"parameters": {"inputObj": {"type": "object"}},
"resources": [],
},
}
},
).result()
print(response)
# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PutDeploymentWithExternalInputs.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armdeployments_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armdeployments"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edacc3b43f9603efa119eabb6013d952d1dbe7d6/specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PutDeploymentWithExternalInputs.json
func ExampleClient_BeginCreateOrUpdate_createDeploymentUsingExternalInputs() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdeployments.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClient().BeginCreateOrUpdate(ctx, "my-resource-group", "my-deployment", armdeployments.Deployment{
Properties: &armdeployments.DeploymentProperties{
ExternalInputDefinitions: map[string]*armdeployments.DeploymentExternalInputDefinition{
"fooValue": {
Config: "FOO_VALUE",
Kind: to.Ptr("sys.envVar"),
},
},
ExternalInputs: map[string]*armdeployments.DeploymentExternalInput{
"fooValue": {
Value: "baz",
},
},
Mode: to.Ptr(armdeployments.DeploymentModeIncremental),
Parameters: map[string]*armdeployments.DeploymentParameter{
"inputObj": {
Expression: to.Ptr("[createObject('foo', externalInputs('fooValue'))]"),
},
},
Template: map[string]any{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"outputs": map[string]any{
"inputObj": map[string]any{
"type": "object",
"value": "[parameters('inputObj')]",
},
},
"parameters": map[string]any{
"inputObj": map[string]any{
"type": "object",
},
},
"resources": []any{},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.DeploymentExtended = armdeployments.DeploymentExtended{
// Name: to.Ptr("my-deployment"),
// Type: to.Ptr("Microsoft.Resources/deployments"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment"),
// Properties: &armdeployments.DeploymentPropertiesExtended{
// CorrelationID: to.Ptr("ef613b6c-f76e-48fd-9da7-28884243c5e5"),
// Dependencies: []*armdeployments.Dependency{
// },
// Mode: to.Ptr(armdeployments.DeploymentModeIncremental),
// OutputResources: []*armdeployments.ResourceReference{
// },
// Outputs: map[string]any{
// "inputObj":map[string]any{
// "type": "Object",
// "value":map[string]any{
// "foo": "baz",
// },
// },
// },
// Parameters: map[string]any{
// "inputObj":map[string]any{
// "type": "Object",
// "value":map[string]any{
// "foo": "baz",
// },
// },
// },
// Providers: []*armdeployments.Provider{
// },
// ProvisioningState: to.Ptr(armdeployments.ProvisioningStateSucceeded),
// TemplateHash: to.Ptr("17686481789412793580"),
// Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-09T14:36:48.204Z"); return t}()),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { DeploymentsClient } = require("@azure/arm-resourcesdeployments");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to You can provide the template and parameters directly in the request or link to JSON files.
*
* @summary You can provide the template and parameters directly in the request or link to JSON files.
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PutDeploymentWithExternalInputs.json
*/
async function createDeploymentUsingExternalInputs() {
const subscriptionId =
process.env["RESOURCES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000001";
const resourceGroupName = process.env["RESOURCES_RESOURCE_GROUP"] || "my-resource-group";
const deploymentName = "my-deployment";
const parameters = {
properties: {
externalInputDefinitions: {
fooValue: { config: "FOO_VALUE", kind: "sys.envVar" },
},
externalInputs: { fooValue: { value: "baz" } },
mode: "Incremental",
parameters: {
inputObj: {
expression: "[createObject('foo', externalInputs('fooValue'))]",
},
},
template: {
$schema: "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
contentVersion: "1.0.0.0",
outputs: {
inputObj: { type: "object", value: "[parameters('inputObj')]" },
},
parameters: { inputObj: { type: "object" } },
resources: [],
},
},
};
const credential = new DefaultAzureCredential();
const client = new DeploymentsClient(credential, subscriptionId);
const result = await client.deployments.beginCreateOrUpdateAndWait(
resourceGroupName,
deploymentName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment",
"name": "my-deployment",
"type": "Microsoft.Resources/deployments",
"properties": {
"templateHash": "17686481789412793580",
"parameters": {
"inputObj": {
"type": "Object",
"value": {
"foo": "baz"
}
}
},
"mode": "Incremental",
"provisioningState": "Succeeded",
"timestamp": "2025-04-09T14:36:48.2047169Z",
"correlationId": "ef613b6c-f76e-48fd-9da7-28884243c5e5",
"providers": [],
"dependencies": [],
"outputs": {
"inputObj": {
"type": "Object",
"value": {
"foo": "baz"
}
}
},
"outputResources": []
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/deployments/my-deployment",
"name": "my-deployment",
"type": "Microsoft.Resources/deployments",
"properties": {
"templateHash": "17686481789412793580",
"parameters": {
"inputObj": {
"type": "Object",
"value": {
"foo": "baz"
}
}
},
"mode": "Incremental",
"provisioningState": "Accepted",
"timestamp": "2025-04-09T14:36:47.6637583Z",
"duration": "PT0.0009164S",
"correlationId": "ef613b6c-f76e-48fd-9da7-28884243c5e5",
"providers": [],
"dependencies": []
}
}
定義
Alias
Object
別名類型。
AliasPath
Object
別名的路徑類型。
| 名稱 |
類型 |
Description |
|
apiVersions
|
string[]
|
API 版本。
|
|
metadata
|
AliasPathMetadata
|
別名路徑的元數據。 如果遺失,請回復為別名的預設元數據。
|
|
path
|
string
|
別名的路徑。
|
|
pattern
|
AliasPattern
|
別名路徑的模式。
|
AliasPathAttributes
列舉型別
別名路徑所參考之令牌的屬性。
| 值 |
Description |
|
None
|
別名路徑所參考的令牌沒有屬性。
|
|
Modifiable
|
別名路徑所參考的令牌可由具有 『modify』 效果的原則修改。
|
Object
AliasPathTokenType
列舉型別
別名路徑所參考之令牌的類型。
| 值 |
Description |
|
NotSpecified
|
未指定令牌類型。
|
|
Any
|
Token 類型可以是任何專案。
|
|
String
|
Token 類型為字串。
|
|
Object
|
Token 類型為物件。
|
|
Array
|
Token 類型為array。
|
|
Integer
|
Token 類型為整數。
|
|
Number
|
Token 類型為 number。
|
|
Boolean
|
Token 類型為布爾值。
|
AliasPattern
Object
別名路徑的模式類型。
| 名稱 |
類型 |
Description |
|
phrase
|
string
|
別名模式片語。
|
|
type
|
AliasPatternType
|
別名模式的類型
|
|
variable
|
string
|
別名模式變數。
|
AliasPatternType
列舉型別
別名模式的類型
| 值 |
Description |
|
NotSpecified
|
不允許 NotSpecified。
|
|
Extract
|
擷取是唯一允許的值。
|
AliasType
列舉型別
別名的類型。
| 值 |
Description |
|
NotSpecified
|
別名類型未知(與未提供別名類型相同)。
|
|
PlainText
|
別名值不是秘密。
|
|
Mask
|
別名值是秘密。
|
ApiProfile
Object
| 名稱 |
類型 |
Description |
|
apiVersion
|
string
|
API 版本。
|
|
profileVersion
|
string
|
配置檔版本。
|
BasicDependency
Object
部署相依性資訊。
| 名稱 |
類型 |
Description |
|
id
|
string
|
相依性標識碼。
|
|
resourceName
|
string
|
相依性資源名稱。
|
|
resourceType
|
string
|
相依性資源類型。
|
CloudError
Object
資源管理要求的錯誤回應。
| 名稱 |
類型 |
Description |
|
error
|
ErrorResponse
|
錯誤回應
所有 Azure Resource Manager API 的常見錯誤回應,以傳回失敗作業的錯誤詳細數據。 (這也遵循 OData 錯誤回應格式。)
|
DebugSetting
Object
偵錯設定。
| 名稱 |
類型 |
Description |
|
detailLevel
|
string
|
指定要記錄以進行偵錯的資訊類型。 允許的值為 none、requestContent、responseContent,或以逗號分隔的 requestContent 和 responseContent。 預設值為 none。 設定此值時,請仔細考慮您在部署期間傳入的信息類型。 藉由記錄要求或回應的相關信息,您可能會公開透過部署作業擷取的敏感數據。
|
Dependency
Object
部署相依性資訊。
| 名稱 |
類型 |
Description |
|
dependsOn
|
BasicDependency[]
|
相依性清單。
|
|
id
|
string
|
相依性標識碼。
|
|
resourceName
|
string
|
相依性資源名稱。
|
|
resourceType
|
string
|
相依性資源類型。
|
Deployment
Object
部署作業參數。
DeploymentDiagnosticsDefinition
Object
| 名稱 |
類型 |
Description |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
錯誤其他資訊。
|
|
code
|
string
|
錯誤碼。
|
|
level
|
Level
|
表示附加回應級別。
|
|
message
|
string
|
錯誤訊息。
|
|
target
|
string
|
錯誤目標。
|
DeploymentExtended
Object
部署資訊。
| 名稱 |
類型 |
Description |
|
id
|
string
|
部署的標識碼。
|
|
location
|
string
|
部署的位置。
|
|
name
|
string
|
部署的名稱。
|
|
properties
|
DeploymentPropertiesExtended
|
部署屬性。
|
|
tags
|
object
|
部署標籤
|
|
type
|
string
|
部署的類型。
|
DeploymentExtensionConfigItem
Object
DeploymentExtensionDefinition
Object
| 名稱 |
類型 |
Description |
|
alias
|
string
|
部署範本中定義的擴展的別名。
|
|
config
|
<string,
DeploymentExtensionConfigItem>
|
擴展配置。
|
|
configId
|
string
|
擴展配置ID。 它唯一標識擴展中的部署控制平面。
|
|
name
|
string
|
延伸模組名稱。
|
|
version
|
string
|
擴展版本。
|
DeploymentExternalInput
Object
部署外部輸入以進行參數化。
| 名稱 |
類型 |
Description |
|
value
|
|
外部輸入值。
|
DeploymentExternalInputDefinition
Object
部署用於參數化的外部輸入定義。
| 名稱 |
類型 |
Description |
|
config
|
|
外部輸入的配置。
|
|
kind
|
string
|
外部輸入的類型。
|
DeploymentIdentity
Object
部署的託管標識配置。
DeploymentIdentityType
列舉型別
識別類型。
| 值 |
Description |
|
None
|
|
|
UserAssigned
|
|
DeploymentMode
列舉型別
用來部署資源的模式。 此值可以是累加式或完成。 在累加模式中,會部署資源,而不刪除範本中未包含的現有資源。 在 [完成] 模式中,會部署資源,且不會包含在範本中的資源群組中現有的資源會遭到刪除。 當您不小心刪除資源時,請小心使用 [完成] 模式。
| 值 |
Description |
|
Incremental
|
|
|
Complete
|
|
DeploymentParameter
Object
範本的部署參數。
| 名稱 |
類型 |
Description |
|
expression
|
string
|
參數的 input expression。
|
|
reference
|
KeyVaultParameterReference
|
Azure Key Vault 參數參考。
|
|
value
|
|
參數的輸入值。
|
DeploymentProperties
Object
部署屬性。
| 名稱 |
類型 |
Description |
|
debugSetting
|
DebugSetting
|
部署的偵錯設定。
|
|
expressionEvaluationOptions
|
ExpressionEvaluationOptions
|
指定是在父範本還是嵌套範本的範圍內計算範本運算式。 僅適用於嵌套範本。 如果未指定,則預設值為 outer。
|
|
extensionConfigs
|
object
|
要用於部署延伸模組的組態。 此物件的索引鍵是部署範本中所定義的部署擴充別名。
|
|
externalInputDefinitions
|
<string,
DeploymentExternalInputDefinition>
|
外部輸入定義,由外部工具用於定義預期的外部輸入值。
|
|
externalInputs
|
<string,
DeploymentExternalInput>
|
外部輸入值,由外部工具用於參數評估。
|
|
mode
|
DeploymentMode
|
用來部署資源的模式。 此值可以是累加式或完成。 在累加模式中,會部署資源,而不刪除範本中未包含的現有資源。 在 [完成] 模式中,會部署資源,且不會包含在範本中的資源群組中現有的資源會遭到刪除。 當您不小心刪除資源時,請小心使用 [完成] 模式。
|
|
onErrorDeployment
|
OnErrorDeployment
|
錯誤行為的部署。
|
|
parameters
|
<string,
DeploymentParameter>
|
定義範本部署參數的名稱和值組。 當您想要直接在要求中提供參數值,而不是連結至現有的參數檔案時,請使用這個專案。 使用parametersLink屬性或parameters屬性,但不能同時使用兩者。 它可以是 JObject 或格式正確的 JSON 字串。
|
|
parametersLink
|
ParametersLink
|
參數檔案的 URI。 您可以使用這個項目連結至現有的參數檔案。 使用parametersLink屬性或parameters屬性,但不能同時使用兩者。
|
|
template
|
object
|
範本內容。 當您想要直接在要求中傳遞範本語法,而不是連結至現有的範本時,請使用這個專案。 它可以是 JObject 或格式正確的 JSON 字串。 使用templateLink屬性或範本屬性,但不能同時使用兩者。
|
|
templateLink
|
TemplateLink
|
範本的 URI。 使用templateLink屬性或範本屬性,但不能同時使用兩者。
|
|
validationLevel
|
ValidationLevel
|
部署的驗證層級
|
DeploymentPropertiesExtended
Object
具有其他詳細數據的部署屬性。
ErrorAdditionalInfo
Object
資源管理錯誤其他資訊。
| 名稱 |
類型 |
Description |
|
info
|
object
|
其他資訊。
|
|
type
|
string
|
其他信息類型。
|
ErrorResponse
Object
錯誤回應
ExpressionEvaluationOptions
Object
指定是在父範本還是嵌套範本的範圍內計算範本運算式。
ExpressionEvaluationOptionsScopeType
列舉型別
用於評估嵌套範本中的參數、變數和函數的作用域。
| 值 |
Description |
|
NotSpecified
|
|
|
Outer
|
|
|
Inner
|
|
ExtensionConfigPropertyType
列舉型別
| 值 |
Description |
|
String
|
表示字串值的屬性類型。
|
|
Int
|
表示整數值的屬性類型。
|
|
Bool
|
Property 類型表示布爾值。
|
|
Array
|
屬性類型。
|
|
Object
|
表示物件值的屬性類型。
|
|
SecureString
|
表示安全字串值的屬性類型。
|
|
SecureObject
|
表示安全物件值的屬性類型。
|
KeyVaultParameterReference
Object
Azure Key Vault 參數參考。
| 名稱 |
類型 |
Description |
|
keyVault
|
KeyVaultReference
|
Azure Key Vault 參考。
|
|
secretName
|
string
|
Azure Key Vault 秘密名稱。
|
|
secretVersion
|
string
|
Azure Key Vault 秘密版本。
|
KeyVaultReference
Object
Azure Key Vault 參考。
| 名稱 |
類型 |
Description |
|
id
|
string
|
Azure Key Vault 資源標識符。
|
Level
列舉型別
表示附加回應級別。
| 值 |
Description |
|
Warning
|
|
|
Info
|
|
|
Error
|
|
OnErrorDeployment
Object
錯誤行為的部署。
| 名稱 |
類型 |
Description |
|
deploymentName
|
string
|
要用於錯誤案例的部署。
|
|
type
|
OnErrorDeploymentType
|
錯誤行為類型的部署。 可能的值為 LastSuccessful 和 SpecificDeployment。
|
OnErrorDeploymentExtended
Object
使用其他詳細數據部署錯誤行為。
| 名稱 |
類型 |
Description |
|
deploymentName
|
string
|
要用於錯誤案例的部署。
|
|
provisioningState
|
string
|
在錯誤部署時布建 的狀態。
|
|
type
|
OnErrorDeploymentType
|
錯誤行為類型的部署。 可能的值為 LastSuccessful 和 SpecificDeployment。
|
OnErrorDeploymentType
列舉型別
錯誤行為類型的部署。 可能的值為 LastSuccessful 和 SpecificDeployment。
| 值 |
Description |
|
LastSuccessful
|
|
|
SpecificDeployment
|
|
ParametersLink
Object
表示部署參數參考的實體。
| 名稱 |
類型 |
Description |
|
contentVersion
|
string
|
如果包含,則必須符合範本中的 ContentVersion。
|
|
uri
|
string
|
參數檔案的 URI。
|
Provider
Object
資源提供者資訊。
| 名稱 |
類型 |
Description |
|
id
|
string
|
提供者標識碼。
|
|
namespace
|
string
|
資源提供者的命名空間。
|
|
providerAuthorizationConsentState
|
ProviderAuthorizationConsentState
|
提供者授權同意狀態。
|
|
registrationPolicy
|
string
|
資源提供者的註冊原則。
|
|
registrationState
|
string
|
資源提供者的註冊狀態。
|
|
resourceTypes
|
ProviderResourceType[]
|
提供者資源類型的集合。
|
ProviderAuthorizationConsentState
列舉型別
提供者授權同意狀態。
| 值 |
Description |
|
NotSpecified
|
|
|
Required
|
|
|
NotRequired
|
|
|
Consented
|
|
ProviderExtendedLocation
Object
提供者擴充位置。
| 名稱 |
類型 |
Description |
|
extendedLocations
|
string[]
|
Azure 位置的擴充位置。
|
|
location
|
string
|
Azure 位置。
|
|
type
|
string
|
擴充位置類型。
|
ProviderResourceType
Object
資源提供者所管理的資源類型。
| 名稱 |
類型 |
Description |
|
aliases
|
Alias[]
|
此資源類型支援的別名。
|
|
apiProfiles
|
ApiProfile[]
|
資源提供者的 API 設定檔。
|
|
apiVersions
|
string[]
|
API 版本。
|
|
capabilities
|
string
|
此資源類型所提供的其他功能。
|
|
defaultApiVersion
|
string
|
預設 API 版本。
|
|
locationMappings
|
ProviderExtendedLocation[]
|
此資源類型所支援的位置對應。
|
|
locations
|
string[]
|
可以建立此資源類型的位置集合。
|
|
properties
|
object
|
屬性。
|
|
resourceType
|
string
|
資源類型。
|
|
zoneMappings
|
ZoneMapping[]
|
|
ProvisioningState
列舉型別
表示布建的狀態。
| 值 |
Description |
|
NotSpecified
|
|
|
Accepted
|
|
|
Running
|
|
|
Ready
|
|
|
Creating
|
|
|
Created
|
|
|
Deleting
|
|
|
Deleted
|
|
|
Canceled
|
|
|
Failed
|
|
|
Succeeded
|
|
|
Updating
|
|
ResourceReference
Object
資源標識元模型。
| 名稱 |
類型 |
Description |
|
apiVersion
|
string
|
部署資源時使用的 API 版本。
|
|
extension
|
DeploymentExtensionDefinition
|
部署資源時使用的擴展。
|
|
id
|
string
|
完全限定的 Azure 資源 ID。
|
|
identifiers
|
object
|
可擴展資源標識碼。
|
|
resourceType
|
string
|
資源類型。
|
TemplateLink
Object
表示範本參考的實體。
| 名稱 |
類型 |
Description |
|
contentVersion
|
string
|
如果包含,則必須符合範本中的 ContentVersion。
|
|
id
|
string
|
範本規格的資源識別碼。請使用標識符或 uri 屬性,但不能同時使用兩者。
|
|
queryString
|
string
|
要與 templateLink URI 搭配使用的查詢字串(例如 SAS 令牌)。
|
|
relativePath
|
string
|
relativePath 屬性可用來在相對於父代的位置部署連結的範本。 如果父範本與 TemplateSpec 連結,這會參考 TemplateSpec 中的成品。 如果父系與 URI 連結,子部署將會是父系和 relativePath URI 的組合
|
|
uri
|
string
|
要部署之範本的 URI。 使用 uri 或 id 屬性,但不能同時使用兩者。
|
UserAssignedIdentity
Object
使用者指派的身分識別屬性
| 名稱 |
類型 |
Description |
|
clientId
|
string
(uuid)
|
指派之身分識別的用戶端標識碼。
|
|
principalId
|
string
(uuid)
|
指派之身分識別的主體標識碼。
|
ValidationLevel
列舉型別
對部署執行的驗證級別。
| 值 |
Description |
|
Template
|
對範本進行靜態分析。
|
|
Provider
|
對範本進行靜態分析,並將資源聲明發送到資源提供程式進行語義驗證。 驗證調用方是否對每個資源具有 RBAC 寫入許可權。
|
|
ProviderNoRbac
|
對範本進行靜態分析,並將資源聲明發送到資源提供程式進行語義驗證。 跳過驗證調用方是否對每個資源具有 RBAC 寫入許可權。
|
ZoneMapping
Object
| 名稱 |
類型 |
Description |
|
location
|
string
|
區域對應的位置。
|
|
zones
|
string[]
|
|