@@ -136,27 +136,33 @@ As an example using the Batch management .NET client, you can create a Batch acc
136
136
and customer-managed keys.
137
137
138
138
``` c#
139
- EncryptionProperties encryptionProperties = new EncryptionProperties ()
139
+ string subscriptionId = " Your SubscriptionID" ;
140
+ string resourceGroupName = " Your ResourceGroup name" ;
141
+
142
+ var credential = new DefaultAzureCredential ();
143
+ ArmClient _armClient = new ArmClient (credential );
144
+
145
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource .CreateResourceIdentifier (subscriptionId , resourceGroupName );
146
+ ResourceGroupResource resourceGroupResource = _armClient .GetResourceGroupResource (resourceGroupResourceId );
147
+
148
+ var data = new BatchAccountCreateOrUpdateContent (AzureLocation .EastUS )
140
149
{
141
- KeySource = KeySource .MicrosoftKeyVault ,
142
- KeyVaultProperties = new KeyVaultProperties ()
150
+ Encryption = new BatchAccountEncryptionConfiguration ()
143
151
{
144
- KeyIdentifier = " Your Key Azure Resource Manager Resource ID "
145
- }
146
- };
152
+ KeySource = BatchAccountKeySource . MicrosoftKeyVault ,
153
+ KeyIdentifier = new Uri ( " Your Key Azure Resource Manager Resource ID " ),
154
+ },
147
155
148
- BatchAccountIdentity identity = new BatchAccountIdentity ()
149
- {
150
- Type = ResourceIdentityType .UserAssigned ,
151
- UserAssignedIdentities = new Dictionary <string , BatchAccountIdentityUserAssignedIdentitiesValue >
156
+ Identity = new ManagedServiceIdentity (ManagedServiceIdentityType .UserAssigned )
152
157
{
153
- [" Your Identity Azure Resource Manager ResourceId" ] = new BatchAccountIdentityUserAssignedIdentitiesValue ()
158
+ UserAssignedIdentities = {
159
+ [new ResourceIdentifier (" Your Identity Azure Resource Manager ResourceId" )] = new UserAssignedIdentity (),
160
+ },
154
161
}
155
162
};
156
- var parameters = new BatchAccountCreateParameters (TestConfiguration .ManagementRegion , encryption :encryptionProperties , identity : identity );
157
163
158
- var account = await batchManagementClient . Account . CreateAsync ( " MyResourceGroup " ,
159
- " mynewaccount " , parameters ) ;
164
+ var lro = resourceGroupResource . GetBatchAccounts (). CreateOrUpdate ( WaitUntil . Completed , " Your BatchAccount name " , data );
165
+ BatchAccountResource batchAccount = lro . Value ;
160
166
```
161
167
162
168
## Update the customer-managed key version
0 commit comments