将资源部署到资源组。
可以直接在请求中提供模板和参数,也可以链接到 JSON 文件。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}?api-version=2025-04-01
URI 参数
名称 |
在 |
必需 |
类型 |
说明 |
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 订阅 ID。
|
api-version
|
query |
True
|
string
|
用于此操作的 API 版本。
|
请求正文
响应
安全性
azure_auth
Azure Active Directory OAuth2 流
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
名称 |
说明 |
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
别名的路径的类型。
AliasPathAttributes
枚举
别名路径引用的令牌的属性。
值 |
说明 |
None
|
别名路径引用的标记没有属性。
|
Modifiable
|
别名路径引用的标记可由具有“modify”效果的策略修改。
|
Object
AliasPathTokenType
枚举
别名路径引用的标记的类型。
值 |
说明 |
NotSpecified
|
未指定标记类型。
|
Any
|
标记类型可以是任何内容。
|
String
|
标记类型为字符串。
|
Object
|
标记类型为对象。
|
Array
|
标记类型为数组。
|
Integer
|
标记类型为整数。
|
Number
|
标记类型为数字。
|
Boolean
|
标记类型为布尔值。
|
AliasPattern
Object
别名路径的模式类型。
名称 |
类型 |
说明 |
phrase
|
string
|
别名模式短语。
|
type
|
AliasPatternType
|
别名模式的类型
|
variable
|
string
|
别名模式变量。
|
AliasPatternType
枚举
别名模式的类型
值 |
说明 |
NotSpecified
|
不允许指定。
|
Extract
|
提取是唯一允许的值。
|
AliasType
枚举
别名的类型。
值 |
说明 |
NotSpecified
|
别名类型未知(与不提供别名类型相同)。
|
PlainText
|
别名值不是机密。
|
Mask
|
别名值为机密。
|
ApiProfile
Object
名称 |
类型 |
说明 |
apiVersion
|
string
|
API 版本。
|
profileVersion
|
string
|
配置文件版本。
|
BasicDependency
Object
部署依赖项信息。
名称 |
类型 |
说明 |
id
|
string
|
依赖项的 ID。
|
resourceName
|
string
|
依赖项资源名称。
|
resourceType
|
string
|
依赖项资源类型。
|
CloudError
Object
资源管理请求的错误响应。
名称 |
类型 |
说明 |
error
|
ErrorResponse
|
错误响应
所有 Azure 资源管理器 API 的常见错误响应,以返回失败操作的错误详细信息。 (这也遵循 OData 错误响应格式。)
|
DebugSetting
Object
调试设置。
名称 |
类型 |
说明 |
detailLevel
|
string
|
指定要记录以供调试的信息的类型。 允许的值不为 none、requestContent、responseContent,或两者均用逗号分隔的 requestContent 和 responseContent。 默认值为 none。 设置此值时,请仔细考虑在部署期间传入的信息类型。 通过记录有关请求或响应的信息,可能会公开通过部署作检索的敏感数据。
|
Dependency
Object
部署依赖项信息。
名称 |
类型 |
说明 |
dependsOn
|
BasicDependency[]
|
依赖项列表。
|
id
|
string
|
依赖项的 ID。
|
resourceName
|
string
|
依赖项资源名称。
|
resourceType
|
string
|
依赖项资源类型。
|
Deployment
Object
部署作参数。
DeploymentDiagnosticsDefinition
Object
名称 |
类型 |
说明 |
additionalInfo
|
ErrorAdditionalInfo[]
|
错误附加信息。
|
code
|
string
|
错误代码。
|
level
|
Level
|
表示附加响应级别。
|
message
|
string
|
错误消息。
|
target
|
string
|
错误目标。
|
DeploymentExtended
Object
部署信息。
名称 |
类型 |
说明 |
id
|
string
|
部署的 ID。
|
location
|
string
|
部署的位置。
|
name
|
string
|
部署的名称。
|
properties
|
DeploymentPropertiesExtended
|
部署属性。
|
tags
|
object
|
部署标记
|
type
|
string
|
部署的类型。
|
DeploymentExtensionConfigItem
Object
DeploymentExtensionDefinition
Object
名称 |
类型 |
说明 |
alias
|
string
|
部署模板中定义的扩展的别名。
|
config
|
<string,
DeploymentExtensionConfigItem>
|
扩展配置。
|
configId
|
string
|
扩展配置 ID。 它唯一标识扩展中的部署控制平面。
|
name
|
string
|
扩展名称。
|
version
|
string
|
扩展版本。
|
DeploymentExternalInput
Object
部署外部输入以进行参数化。
DeploymentExternalInputDefinition
Object
部署用于参数化的外部输入定义。
名称 |
类型 |
说明 |
config
|
|
外部输入的配置。
|
kind
|
string
|
外部输入的类型。
|
DeploymentIdentity
Object
部署的托管标识配置。
DeploymentIdentityType
枚举
标识类型。
DeploymentMode
枚举
用于部署资源的模式。 此值可以是增量值,也可以是“完成”。 在增量模式下,部署资源而不删除模板中不包含的现有资源。 在“完成”模式下,将部署资源,并删除模板中不包含的资源组中的现有资源。 使用“完成”模式时请注意,因为可能会无意中删除资源。
值 |
说明 |
Incremental
|
|
Complete
|
|
DeploymentParameter
Object
模板的部署参数。
DeploymentProperties
Object
部署属性。
名称 |
类型 |
说明 |
debugSetting
|
DebugSetting
|
部署的调试设置。
|
expressionEvaluationOptions
|
ExpressionEvaluationOptions
|
指定模板表达式是在父模板或嵌套模板的范围内计算的。 仅适用于嵌套模板。 如果未指定,则默认值为外部值。
|
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
资源管理错误附加信息。
名称 |
类型 |
说明 |
info
|
object
|
其他信息。
|
type
|
string
|
其他信息类型。
|
ErrorResponse
Object
错误响应
ExpressionEvaluationOptions
Object
指定模板表达式是在父模板或嵌套模板的范围内计算的。
ExpressionEvaluationOptionsScopeType
枚举
用于计算嵌套模板中的参数、变量和函数的范围。
值 |
说明 |
NotSpecified
|
|
Outer
|
|
Inner
|
|
ExtensionConfigPropertyType
枚举
值 |
说明 |
String
|
表示字符串值的属性类型。
|
Int
|
表示整数值的属性类型。
|
Bool
|
Property 类型表示布尔值。
|
Array
|
属性类型。
|
Object
|
表示对象值的属性类型。
|
SecureString
|
表示安全字符串值的属性类型。
|
SecureObject
|
表示安全对象值的属性类型。
|
KeyVaultParameterReference
Object
Azure Key Vault 参数引用。
名称 |
类型 |
说明 |
keyVault
|
KeyVaultReference
|
Azure Key Vault 参考。
|
secretName
|
string
|
Azure Key Vault 机密名称。
|
secretVersion
|
string
|
Azure Key Vault 机密版本。
|
KeyVaultReference
Object
Azure Key Vault 参考。
名称 |
类型 |
说明 |
id
|
string
|
Azure Key Vault 资源 ID。
|
Level
枚举
表示附加响应级别。
OnErrorDeployment
Object
针对错误行为进行部署。
名称 |
类型 |
说明 |
deploymentName
|
string
|
要用于错误案例的部署。
|
type
|
OnErrorDeploymentType
|
错误行为类型的部署。 可能的值为 LastSuccessful 和 SpecificDeployment。
|
OnErrorDeploymentExtended
Object
有关错误行为的部署,并提供了其他详细信息。
名称 |
类型 |
说明 |
deploymentName
|
string
|
要用于错误案例的部署。
|
provisioningState
|
string
|
错误部署的预配状态。
|
type
|
OnErrorDeploymentType
|
错误行为类型的部署。 可能的值为 LastSuccessful 和 SpecificDeployment。
|
OnErrorDeploymentType
枚举
错误行为类型的部署。 可能的值为 LastSuccessful 和 SpecificDeployment。
值 |
说明 |
LastSuccessful
|
|
SpecificDeployment
|
|
ParametersLink
Object
表示对部署参数的引用的实体。
名称 |
类型 |
说明 |
contentVersion
|
string
|
如果包含,则必须匹配模板中的 ContentVersion。
|
uri
|
string
|
参数文件的 URI。
|
Provider
Object
资源提供程序信息。
ProviderAuthorizationConsentState
枚举
提供程序授权许可状态。
值 |
说明 |
NotSpecified
|
|
Required
|
|
NotRequired
|
|
Consented
|
|
ProviderExtendedLocation
Object
提供程序扩展位置。
名称 |
类型 |
说明 |
extendedLocations
|
string[]
|
Azure 位置的扩展位置。
|
location
|
string
|
Azure 位置。
|
type
|
string
|
扩展位置类型。
|
ProviderResourceType
Object
资源提供程序管理的资源类型。
名称 |
类型 |
说明 |
aliases
|
Alias[]
|
此资源类型支持的别名。
|
apiProfiles
|
ApiProfile[]
|
资源提供程序的 API 配置文件。
|
apiVersions
|
string[]
|
API 版本。
|
capabilities
|
string
|
此资源类型提供的其他功能。
|
defaultApiVersion
|
string
|
默认 API 版本。
|
locationMappings
|
ProviderExtendedLocation[]
|
此资源类型支持的位置映射。
|
locations
|
string[]
|
可以创建此资源类型的位置的集合。
|
properties
|
object
|
属性。
|
resourceType
|
string
|
资源类型。
|
zoneMappings
|
ZoneMapping[]
|
|
ProvisioningState
枚举
表示预配的状态。
值 |
说明 |
NotSpecified
|
|
Accepted
|
|
Running
|
|
Ready
|
|
Creating
|
|
Created
|
|
Deleting
|
|
Deleted
|
|
Canceled
|
|
Failed
|
|
Succeeded
|
|
Updating
|
|
ResourceReference
Object
资源 ID 模型。
名称 |
类型 |
说明 |
apiVersion
|
string
|
部署资源时使用的 API 版本。
|
extension
|
DeploymentExtensionDefinition
|
部署资源时使用的扩展。
|
id
|
string
|
完全限定的 Azure 资源 ID。
|
identifiers
|
object
|
可扩展资源标识符。
|
resourceType
|
string
|
资源类型。
|
TemplateLink
Object
表示对模板的引用的实体。
名称 |
类型 |
说明 |
contentVersion
|
string
|
如果包含,则必须匹配模板中的 ContentVersion。
|
id
|
string
|
模板规格的资源 ID。请使用 ID 或 uri 属性,但不能同时使用这两个属性。
|
queryString
|
string
|
要与 templateLink URI 一起使用的查询字符串(例如 SAS 令牌)。
|
relativePath
|
string
|
relativePath 属性可用于在相对于父级的位置部署链接模板。 如果父模板与 TemplateSpec 链接,则会引用 TemplateSpec 中的项目。 如果父级已链接到 URI,则子部署将是父 URI 和 relativePath URI 的组合
|
uri
|
string
|
要部署的模板的 URI。 使用 URI 或 ID 属性,但不能同时使用这两个属性。
|
UserAssignedIdentity
Object
用户分配的标识属性
名称 |
类型 |
说明 |
clientId
|
string
(uuid)
|
分配的标识的客户端 ID。
|
principalId
|
string
(uuid)
|
已分配标识的主体 ID。
|
ValidationLevel
枚举
对部署执行的验证级别。
值 |
说明 |
Template
|
对模板进行静态分析。
|
Provider
|
对模板进行静态分析,并将资源声明发送到资源提供程序进行语义验证。 验证调用方是否对每个资源具有 RBAC 写入权限。
|
ProviderNoRbac
|
对模板进行静态分析,并将资源声明发送到资源提供程序进行语义验证。 跳过验证调用方是否对每个资源具有 RBAC 写入权限。
|
ZoneMapping
Object
名称 |
类型 |
说明 |
location
|
string
|
区域映射的位置。
|
zones
|
string[]
|
|