ブループリントの割り当てを作成または更新します。
PUT https://management.azure.com/{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}?api-version=2018-11-01-preview
URI パラメーター
名前 |
/ |
必須 |
型 |
説明 |
assignmentName
|
path |
True
|
string
|
ブループリント割り当ての名前。
|
resourceScope
|
path |
True
|
string
|
リソースのスコープ。 有効なスコープは、管理グループ (形式: '/providers/Microsoft.Management/managementGroups/{managementGroup}')、サブスクリプション (形式: '/subscriptions/{subscriptionId}') です。
|
api-version
|
query |
True
|
string
|
クライアント API のバージョン。
|
要求本文
名前 |
必須 |
型 |
説明 |
identity
|
True
|
ManagedServiceIdentity
|
このブループリント割り当てのマネージド ID。
|
location
|
True
|
string
|
このブループリント割り当ての場所。
|
properties.parameters
|
True
|
<string,
ParameterValue>
|
ブループリント割り当てパラメーターの値。
|
properties.resourceGroups
|
True
|
<string,
ResourceGroupValue>
|
リソース グループ プレースホルダーの名前と場所。
|
properties.blueprintId
|
|
string
|
ブループリント定義の発行済みバージョンの ID。
|
properties.description
|
|
string
maxLength: 500
|
複数行でこのリソースについて説明します。
|
properties.displayName
|
|
string
maxLength: 256
|
このリソースを説明する 1 行の文字列。
|
properties.locks
|
|
AssignmentLockSettings
|
ブループリント割り当てによってデプロイされたリソースをロックする方法を定義します。
|
properties.scope
|
|
string
|
ブループリント割り当てのターゲット サブスクリプション スコープ (形式: '/subscriptions/{subscriptionId}')。 管理グループ レベルの割り当てには、プロパティが必要です。
|
応答
名前 |
型 |
説明 |
201 Created
|
Assignment
|
作成済み -- ブループリントの割り当てが保存されました。
|
Other Status Codes
|
CloudError
|
ブループリントエラー応答。
|
セキュリティ
azure_auth
Azure Active Directory OAuth2 フロー
型:
oauth2
フロー:
implicit
Authorization URL (承認 URL):
https://login.microsoftonline.com/common/oauth2/authorize
スコープ
名前 |
説明 |
user_impersonation
|
ユーザー アカウントを偽装する
|
例
Assignment with system-assigned managed identity at management group scope
要求のサンプル
PUT https://management.azure.com/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprintAssignments/assignSimpleBlueprint?api-version=2018-11-01-preview
{
"identity": {
"type": "SystemAssigned"
},
"location": "eastus",
"properties": {
"description": "enforce pre-defined simpleBlueprint to this XXXXXXXX subscription.",
"blueprintId": "/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint",
"scope": "subscriptions/00000000-0000-0000-0000-000000000000",
"parameters": {
"storageAccountType": {
"value": "Standard_LRS"
},
"costCenter": {
"value": "Contoso/Online/Shopping/Production"
},
"owners": {
"value": [
"johnDoe@contoso.com",
"johnsteam@contoso.com"
]
}
},
"resourceGroups": {
"storageRG": {
"name": "defaultRG",
"location": "eastus"
}
}
}
}
package armblueprint_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/blueprint/armblueprint"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignment_Create_SystemAssignedMSI.json
func ExampleAssignmentsClient_CreateOrUpdate_assignmentWithSystemAssignedManagedIdentityAtManagementGroupScope() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armblueprint.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
_, err = clientFactory.NewAssignmentsClient().CreateOrUpdate(ctx, "managementGroups/ContosoOnlineGroup", "assignSimpleBlueprint", armblueprint.Assignment{
Location: to.Ptr("eastus"),
Identity: &armblueprint.ManagedServiceIdentity{
Type: to.Ptr(armblueprint.ManagedServiceIdentityTypeSystemAssigned),
},
Properties: &armblueprint.AssignmentProperties{
Description: to.Ptr("enforce pre-defined simpleBlueprint to this XXXXXXXX subscription."),
BlueprintID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"),
Parameters: map[string]*armblueprint.ParameterValue{
"costCenter": {
Value: "Contoso/Online/Shopping/Production",
},
"owners": {
Value: []any{
"johnDoe@contoso.com",
"johnsteam@contoso.com",
},
},
"storageAccountType": {
Value: "Standard_LRS",
},
},
ResourceGroups: map[string]*armblueprint.ResourceGroupValue{
"storageRG": {
Name: to.Ptr("defaultRG"),
Location: to.Ptr("eastus"),
},
},
Scope: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Blueprint;
using Azure.ResourceManager.Blueprint.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignment_Create_SystemAssignedMSI.json
// this example is just showing the usage of "Assignments_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this AssignmentResource created on azure
// for more information of creating AssignmentResource, please refer to the document of AssignmentResource
string resourceScope = "managementGroups/ContosoOnlineGroup";
string assignmentName = "assignSimpleBlueprint";
ResourceIdentifier assignmentResourceId = AssignmentResource.CreateResourceIdentifier(resourceScope, assignmentName);
AssignmentResource assignment = client.GetAssignmentResource(assignmentResourceId);
// invoke the operation
AssignmentData data = new AssignmentData(new Models.ManagedServiceIdentity(ManagedServiceIdentityType.SystemAssigned), new Dictionary<string, ParameterValue>()
{
["costCenter"] = new ParameterValue()
{
Value = BinaryData.FromString("Contoso/Online/Shopping/Production"),
},
["owners"] = new ParameterValue()
{
Value = BinaryData.FromObjectAsJson(new object[] { "johnDoe@contoso.com", "johnsteam@contoso.com" }),
},
["storageAccountType"] = new ParameterValue()
{
Value = BinaryData.FromString("Standard_LRS"),
},
}, new Dictionary<string, ResourceGroupValue>()
{
["storageRG"] = new ResourceGroupValue()
{
Name = "defaultRG",
Location = new AzureLocation("eastus"),
},
}, new AzureLocation("eastus"))
{
Description = "enforce pre-defined simpleBlueprint to this XXXXXXXX subscription.",
BlueprintId = "/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint",
Scope = "subscriptions/00000000-0000-0000-0000-000000000000",
};
ArmOperation<AssignmentResource> lro = await assignment.UpdateAsync(WaitUntil.Completed, data);
AssignmentResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
AssignmentData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"identity": {
"type": "SystemAssigned",
"tenantId": "00000000-0000-0000-0000-000000000000",
"principalId": "00000000-0000-0000-0000-000000000000"
},
"location": "eastus",
"properties": {
"description": "enforce pre-defined simpleBlueprint to this XXXXXXXX subscription.",
"provisioningState": "creating",
"blueprintId": "/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint",
"scope": "subscriptions/00000000-0000-0000-0000-000000000000",
"parameters": {
"storageAccountType": {
"value": "Standard_LRS"
},
"costCenter": {
"value": "Contoso/Online/Shopping/Production"
},
"owners": {
"value": [
"johnDoe@contoso.com",
"johnsteam@contoso.com"
]
}
},
"resourceGroups": {
"storageRG": {
"name": "defaultRG",
"location": "eastus"
}
}
},
"id": "/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprintAssignments/assignSimpleBlueprint",
"type": "Microsoft.Blueprint/Assignment",
"name": "assignSimpleBlueprint"
}
Assignment with system-assigned managed identity at subscription scope
要求のサンプル
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprintAssignments/assignSimpleBlueprint?api-version=2018-11-01-preview
{
"identity": {
"type": "SystemAssigned"
},
"location": "eastus",
"properties": {
"description": "enforce pre-defined simpleBlueprint to this XXXXXXXX subscription.",
"blueprintId": "/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint",
"parameters": {
"storageAccountType": {
"value": "Standard_LRS"
},
"costCenter": {
"value": "Contoso/Online/Shopping/Production"
},
"owners": {
"value": [
"johnDoe@contoso.com",
"johnsteam@contoso.com"
]
}
},
"resourceGroups": {
"storageRG": {
"name": "defaultRG",
"location": "eastus"
}
}
}
}
package armblueprint_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/blueprint/armblueprint"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPAssignment/BlueprintAssignment_Create_SystemAssignedMSI.json
func ExampleAssignmentsClient_CreateOrUpdate_assignmentWithSystemAssignedManagedIdentityAtSubscriptionScope() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armblueprint.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
_, err = clientFactory.NewAssignmentsClient().CreateOrUpdate(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "assignSimpleBlueprint", armblueprint.Assignment{
Location: to.Ptr("eastus"),
Identity: &armblueprint.ManagedServiceIdentity{
Type: to.Ptr(armblueprint.ManagedServiceIdentityTypeSystemAssigned),
},
Properties: &armblueprint.AssignmentProperties{
Description: to.Ptr("enforce pre-defined simpleBlueprint to this XXXXXXXX subscription."),
BlueprintID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"),
Parameters: map[string]*armblueprint.ParameterValue{
"costCenter": {
Value: "Contoso/Online/Shopping/Production",
},
"owners": {
Value: []any{
"johnDoe@contoso.com",
"johnsteam@contoso.com",
},
},
"storageAccountType": {
Value: "Standard_LRS",
},
},
ResourceGroups: map[string]*armblueprint.ResourceGroupValue{
"storageRG": {
Name: to.Ptr("defaultRG"),
Location: to.Ptr("eastus"),
},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Blueprint;
using Azure.ResourceManager.Blueprint.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPAssignment/BlueprintAssignment_Create_SystemAssignedMSI.json
// this example is just showing the usage of "Assignments_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this AssignmentResource created on azure
// for more information of creating AssignmentResource, please refer to the document of AssignmentResource
string resourceScope = "subscriptions/00000000-0000-0000-0000-000000000000";
string assignmentName = "assignSimpleBlueprint";
ResourceIdentifier assignmentResourceId = AssignmentResource.CreateResourceIdentifier(resourceScope, assignmentName);
AssignmentResource assignment = client.GetAssignmentResource(assignmentResourceId);
// invoke the operation
AssignmentData data = new AssignmentData(new Models.ManagedServiceIdentity(ManagedServiceIdentityType.SystemAssigned), new Dictionary<string, ParameterValue>()
{
["costCenter"] = new ParameterValue()
{
Value = BinaryData.FromString("Contoso/Online/Shopping/Production"),
},
["owners"] = new ParameterValue()
{
Value = BinaryData.FromObjectAsJson(new object[] { "johnDoe@contoso.com", "johnsteam@contoso.com" }),
},
["storageAccountType"] = new ParameterValue()
{
Value = BinaryData.FromString("Standard_LRS"),
},
}, new Dictionary<string, ResourceGroupValue>()
{
["storageRG"] = new ResourceGroupValue()
{
Name = "defaultRG",
Location = new AzureLocation("eastus"),
},
}, new AzureLocation("eastus"))
{
Description = "enforce pre-defined simpleBlueprint to this XXXXXXXX subscription.",
BlueprintId = "/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint",
};
ArmOperation<AssignmentResource> lro = await assignment.UpdateAsync(WaitUntil.Completed, data);
AssignmentResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
AssignmentData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"identity": {
"type": "SystemAssigned",
"tenantId": "00000000-0000-0000-0000-000000000000",
"principalId": "00000000-0000-0000-0000-000000000000"
},
"location": "eastus",
"properties": {
"description": "enforce pre-defined simpleBlueprint to this XXXXXXXX subscription.",
"provisioningState": "creating",
"blueprintId": "/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint",
"parameters": {
"storageAccountType": {
"value": "Standard_LRS"
},
"costCenter": {
"value": "Contoso/Online/Shopping/Production"
},
"owners": {
"value": [
"johnDoe@contoso.com",
"johnsteam@contoso.com"
]
}
},
"resourceGroups": {
"storageRG": {
"name": "defaultRG",
"location": "eastus"
}
}
},
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprintAssignments/assignSimpleBlueprint",
"type": "Microsoft.Blueprint/Assignment",
"name": "assignSimpleBlueprint"
}
Assignment with user-assigned managed identity at management group scope
要求のサンプル
PUT https://management.azure.com/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprintAssignments/assignSimpleBlueprint?api-version=2018-11-01-preview
{
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": {}
}
},
"location": "eastus",
"properties": {
"description": "enforce pre-defined simpleBlueprint to this XXXXXXXX subscription.",
"blueprintId": "/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint",
"scope": "subscriptions/00000000-0000-0000-0000-000000000000",
"parameters": {
"storageAccountType": {
"value": "Standard_LRS"
},
"costCenter": {
"value": "Contoso/Online/Shopping/Production"
},
"owners": {
"value": [
"johnDoe@contoso.com",
"johnsteam@contoso.com"
]
}
},
"resourceGroups": {
"storageRG": {
"name": "defaultRG",
"location": "eastus"
}
}
}
}
package armblueprint_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/blueprint/armblueprint"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignment_Create_UserAssignedMSI.json
func ExampleAssignmentsClient_CreateOrUpdate_assignmentWithUserAssignedManagedIdentityAtManagementGroupScope() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armblueprint.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
_, err = clientFactory.NewAssignmentsClient().CreateOrUpdate(ctx, "managementGroups/ContosoOnlineGroup", "assignSimpleBlueprint", armblueprint.Assignment{
Location: to.Ptr("eastus"),
Identity: &armblueprint.ManagedServiceIdentity{
Type: to.Ptr(armblueprint.ManagedServiceIdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armblueprint.UserAssignedIdentity{
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": {},
},
},
Properties: &armblueprint.AssignmentProperties{
Description: to.Ptr("enforce pre-defined simpleBlueprint to this XXXXXXXX subscription."),
BlueprintID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"),
Parameters: map[string]*armblueprint.ParameterValue{
"costCenter": {
Value: "Contoso/Online/Shopping/Production",
},
"owners": {
Value: []any{
"johnDoe@contoso.com",
"johnsteam@contoso.com",
},
},
"storageAccountType": {
Value: "Standard_LRS",
},
},
ResourceGroups: map[string]*armblueprint.ResourceGroupValue{
"storageRG": {
Name: to.Ptr("defaultRG"),
Location: to.Ptr("eastus"),
},
},
Scope: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Blueprint;
using Azure.ResourceManager.Blueprint.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignment_Create_UserAssignedMSI.json
// this example is just showing the usage of "Assignments_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this AssignmentResource created on azure
// for more information of creating AssignmentResource, please refer to the document of AssignmentResource
string resourceScope = "managementGroups/ContosoOnlineGroup";
string assignmentName = "assignSimpleBlueprint";
ResourceIdentifier assignmentResourceId = AssignmentResource.CreateResourceIdentifier(resourceScope, assignmentName);
AssignmentResource assignment = client.GetAssignmentResource(assignmentResourceId);
// invoke the operation
AssignmentData data = new AssignmentData(new Models.ManagedServiceIdentity(ManagedServiceIdentityType.UserAssigned)
{
UserAssignedIdentities =
{
["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity"] = new UserAssignedIdentity(),
},
}, new Dictionary<string, ParameterValue>()
{
["costCenter"] = new ParameterValue()
{
Value = BinaryData.FromString("Contoso/Online/Shopping/Production"),
},
["owners"] = new ParameterValue()
{
Value = BinaryData.FromObjectAsJson(new object[] { "johnDoe@contoso.com", "johnsteam@contoso.com" }),
},
["storageAccountType"] = new ParameterValue()
{
Value = BinaryData.FromString("Standard_LRS"),
},
}, new Dictionary<string, ResourceGroupValue>()
{
["storageRG"] = new ResourceGroupValue()
{
Name = "defaultRG",
Location = new AzureLocation("eastus"),
},
}, new AzureLocation("eastus"))
{
Description = "enforce pre-defined simpleBlueprint to this XXXXXXXX subscription.",
BlueprintId = "/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint",
Scope = "subscriptions/00000000-0000-0000-0000-000000000000",
};
ArmOperation<AssignmentResource> lro = await assignment.UpdateAsync(WaitUntil.Completed, data);
AssignmentResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
AssignmentData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"identity": {
"type": "UserAssigned",
"tenantId": "00000000-0000-0000-0000-000000000000",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": {
"principalId": "00000000-0000-0000-0000-000000000000",
"clientId": "00000000-0000-0000-0000-000000000000"
}
}
},
"location": "eastus",
"properties": {
"description": "enforce pre-defined simpleBlueprint to this XXXXXXXX subscription.",
"provisioningState": "creating",
"blueprintId": "/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint",
"scope": "subscriptions/00000000-0000-0000-0000-000000000000",
"parameters": {
"storageAccountType": {
"value": "Standard_LRS"
},
"costCenter": {
"value": "Contoso/Online/Shopping/Production"
},
"owners": {
"value": [
"johnDoe@contoso.com",
"johnsteam@contoso.com"
]
}
},
"resourceGroups": {
"storageRG": {
"name": "defaultRG",
"location": "eastus"
}
}
},
"id": "/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprintAssignments/assignSimpleBlueprint",
"type": "Microsoft.Blueprint/Assignment",
"name": "assignSimpleBlueprint"
}
Assignment with user-assigned managed identity at subscription scope
要求のサンプル
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprintAssignments/assignSimpleBlueprint?api-version=2018-11-01-preview
{
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": {}
}
},
"location": "eastus",
"properties": {
"description": "enforce pre-defined simpleBlueprint to this XXXXXXXX subscription.",
"blueprintId": "/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint",
"parameters": {
"storageAccountType": {
"value": "Standard_LRS"
},
"costCenter": {
"value": "Contoso/Online/Shopping/Production"
},
"owners": {
"value": [
"johnDoe@contoso.com",
"johnsteam@contoso.com"
]
}
},
"resourceGroups": {
"storageRG": {
"name": "defaultRG",
"location": "eastus"
}
}
}
}
package armblueprint_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/blueprint/armblueprint"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPAssignment/BlueprintAssignment_Create_UserAssignedMSI.json
func ExampleAssignmentsClient_CreateOrUpdate_assignmentWithUserAssignedManagedIdentityAtSubscriptionScope() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armblueprint.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
_, err = clientFactory.NewAssignmentsClient().CreateOrUpdate(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "assignSimpleBlueprint", armblueprint.Assignment{
Location: to.Ptr("eastus"),
Identity: &armblueprint.ManagedServiceIdentity{
Type: to.Ptr(armblueprint.ManagedServiceIdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armblueprint.UserAssignedIdentity{
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": {},
},
},
Properties: &armblueprint.AssignmentProperties{
Description: to.Ptr("enforce pre-defined simpleBlueprint to this XXXXXXXX subscription."),
BlueprintID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"),
Parameters: map[string]*armblueprint.ParameterValue{
"costCenter": {
Value: "Contoso/Online/Shopping/Production",
},
"owners": {
Value: []any{
"johnDoe@contoso.com",
"johnsteam@contoso.com",
},
},
"storageAccountType": {
Value: "Standard_LRS",
},
},
ResourceGroups: map[string]*armblueprint.ResourceGroupValue{
"storageRG": {
Name: to.Ptr("defaultRG"),
Location: to.Ptr("eastus"),
},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Blueprint;
using Azure.ResourceManager.Blueprint.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPAssignment/BlueprintAssignment_Create_UserAssignedMSI.json
// this example is just showing the usage of "Assignments_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this AssignmentResource created on azure
// for more information of creating AssignmentResource, please refer to the document of AssignmentResource
string resourceScope = "subscriptions/00000000-0000-0000-0000-000000000000";
string assignmentName = "assignSimpleBlueprint";
ResourceIdentifier assignmentResourceId = AssignmentResource.CreateResourceIdentifier(resourceScope, assignmentName);
AssignmentResource assignment = client.GetAssignmentResource(assignmentResourceId);
// invoke the operation
AssignmentData data = new AssignmentData(new Models.ManagedServiceIdentity(ManagedServiceIdentityType.UserAssigned)
{
UserAssignedIdentities =
{
["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity"] = new UserAssignedIdentity(),
},
}, new Dictionary<string, ParameterValue>()
{
["costCenter"] = new ParameterValue()
{
Value = BinaryData.FromString("Contoso/Online/Shopping/Production"),
},
["owners"] = new ParameterValue()
{
Value = BinaryData.FromObjectAsJson(new object[] { "johnDoe@contoso.com", "johnsteam@contoso.com" }),
},
["storageAccountType"] = new ParameterValue()
{
Value = BinaryData.FromString("Standard_LRS"),
},
}, new Dictionary<string, ResourceGroupValue>()
{
["storageRG"] = new ResourceGroupValue()
{
Name = "defaultRG",
Location = new AzureLocation("eastus"),
},
}, new AzureLocation("eastus"))
{
Description = "enforce pre-defined simpleBlueprint to this XXXXXXXX subscription.",
BlueprintId = "/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint",
};
ArmOperation<AssignmentResource> lro = await assignment.UpdateAsync(WaitUntil.Completed, data);
AssignmentResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
AssignmentData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"identity": {
"type": "UserAssigned",
"tenantId": "00000000-0000-0000-0000-000000000000",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": {
"principalId": "00000000-0000-0000-0000-000000000000",
"clientId": "00000000-0000-0000-0000-000000000000"
}
}
},
"location": "eastus",
"properties": {
"description": "enforce pre-defined simpleBlueprint to this XXXXXXXX subscription.",
"provisioningState": "creating",
"blueprintId": "/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint",
"parameters": {
"storageAccountType": {
"value": "Standard_LRS"
},
"costCenter": {
"value": "Contoso/Online/Shopping/Production"
},
"owners": {
"value": [
"johnDoe@contoso.com",
"johnsteam@contoso.com"
]
}
},
"resourceGroups": {
"storageRG": {
"name": "defaultRG",
"location": "eastus"
}
}
},
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprintAssignments/assignSimpleBlueprint",
"type": "Microsoft.Blueprint/Assignment",
"name": "assignSimpleBlueprint"
}
定義
Assignment
Object
ブループリントの割り当てを表します。
名前 |
型 |
説明 |
id
|
string
|
Azure 上の任意のリソースを検索するために使用される文字列 ID。
|
identity
|
ManagedServiceIdentity
|
このブループリント割り当てのマネージド ID。
|
location
|
string
|
このブループリント割り当ての場所。
|
name
|
string
|
このリソースの名前。
|
properties.blueprintId
|
string
|
ブループリント定義の発行済みバージョンの ID。
|
properties.description
|
string
maxLength: 500
|
複数行でこのリソースについて説明します。
|
properties.displayName
|
string
maxLength: 256
|
このリソースを説明する 1 行の文字列。
|
properties.locks
|
AssignmentLockSettings
|
ブループリント割り当てによってデプロイされたリソースをロックする方法を定義します。
|
properties.parameters
|
<string,
ParameterValue>
|
ブループリント割り当てパラメーターの値。
|
properties.provisioningState
|
AssignmentProvisioningState
|
ブループリント割り当ての状態。
|
properties.resourceGroups
|
<string,
ResourceGroupValue>
|
リソース グループ プレースホルダーの名前と場所。
|
properties.scope
|
string
|
ブループリント割り当てのターゲット サブスクリプション スコープ (形式: '/subscriptions/{subscriptionId}')。 管理グループ レベルの割り当てには、プロパティが必要です。
|
properties.status
|
AssignmentStatus
|
ブループリント割り当ての状態。 このフィールドは読み取り時です。
|
type
|
string
|
このリソースの種類。
|
AssignmentLockMode
列挙
ロック モード。
値 |
説明 |
AllResourcesDoNotDelete
|
|
AllResourcesReadOnly
|
|
None
|
|
AssignmentLockSettings
Object
ブループリント割り当てによってデプロイされたリソースをロックする方法を定義します。
名前 |
型 |
説明 |
excludedActions
|
string[]
|
ブループリント ロックから除外される管理操作の一覧。 最大 200 個のアクションが許可されます。 ロック モードが 'AllResourcesReadOnly' に設定されている場合、'excludedActions'、'*/read'、'Microsoft.Network/virtualNetworks/subnets/join/action'、および 'Microsoft.Authorization/locks/delete' に次のアクションが自動的に追加されます。 ロック モードが 'AllResourcesDoNotDelete' に設定されている場合、次のアクションが自動的に 'excludedActions' に追加されます: 'Microsoft.Authorization/locks/delete'。 重複するアクションは削除されます。
|
excludedPrincipals
|
string[]
|
ブループリント ロックから除外された AAD プリンシパルの一覧。 最大 5 つのプリンシパルが許可されます。
|
mode
|
AssignmentLockMode
|
ロック モード。
|
AssignmentProvisioningState
列挙
ブループリント割り当ての状態。
値 |
説明 |
canceled
|
|
cancelling
|
|
creating
|
|
deleting
|
|
deploying
|
|
failed
|
|
locking
|
|
succeeded
|
|
validating
|
|
waiting
|
|
AssignmentStatus
Object
ブループリント割り当ての状態。 このフィールドは読み取り時です。
名前 |
型 |
説明 |
lastModified
|
string
(date-time)
|
このブループリント定義の最終変更時刻。
|
managedResources
|
string[]
|
ブループリント割り当てによって作成されたリソースの一覧。
|
timeCreated
|
string
(date-time)
|
このブループリント定義の作成時間。
|
CloudError
Object
名前 |
型 |
説明 |
error
|
ErrorResponse
|
エラー応答
失敗した操作のエラーの詳細を返す、すべての Azure Resource Manager API の一般的なエラー応答。 (これは、OData エラー応答形式にも従います)。
|
ErrorAdditionalInfo
Object
リソース管理エラーの追加情報。
名前 |
型 |
説明 |
info
|
object
|
追加情報。
|
type
|
string
|
追加情報の種類。
|
ErrorResponse
Object
エラー応答
keyVaultReference
Object
Key Vault へのリンクを指定します。
名前 |
型 |
説明 |
id
|
string
|
Key Vault の Azure リソース ID。
|
ManagedServiceIdentity
Object
マネージド ID 汎用オブジェクト。
名前 |
型 |
説明 |
principalId
|
string
|
この ID に関連付けられている Azure Active Directory プリンシパル ID。
|
tenantId
|
string
|
Azure Active Directory の ID。
|
type
|
ManagedServiceIdentityType
|
マネージド ID の種類。
|
userAssignedIdentities
|
<string,
UserAssignedIdentity>
|
リソースに関連付けられているユーザー割り当てマネージド ID の一覧。 キーは、マネージド ID の Azure リソース ID です。
|
ManagedServiceIdentityType
列挙
マネージド ID の種類。
値 |
説明 |
None
|
|
SystemAssigned
|
|
UserAssigned
|
|
ParameterValue
Object
指定したパラメーターの値。 'value' または 'reference' のいずれかを指定できますが、両方を指定することはできません。
名前 |
型 |
説明 |
reference
|
SecretValueReference
|
参照型としてのパラメーター値。
|
value
|
object
|
パラメーター値。 オブジェクト、配列、文字列、数値、ブール値など、有効な JSON 値を指定できます。
|
ResourceGroupValue
Object
Azure リソース グループを表します。
名前 |
型 |
説明 |
location
|
string
|
リソース グループの場所。
|
name
|
string
minLength: 1 maxLength: 90
|
リソース グループの名前。
|
SecretValueReference
Object
Key Vault シークレットへの参照。
名前 |
型 |
説明 |
keyVault
|
keyVaultReference
|
特定の Azure Key Vault への参照を指定します。
|
secretName
|
string
|
シークレットの名前。
|
secretVersion
|
string
|
使用するシークレットのバージョン。 空白のままにすると、最新バージョンのシークレットが使用されます。
|
UserAssignedIdentity
Object
ユーザー割り当てマネージド ID。
名前 |
型 |
説明 |
clientId
|
string
|
この ID に関連付けられているクライアント アプリ ID。
|
principalId
|
string
|
この ID に関連付けられている Azure Active Directory プリンシパル ID。
|