text: /*
   * Copyright (c) Microsoft Corporation.
   * Licensed under the MIT License.
   *
   * Code generated by Microsoft (R) AutoRest Code Generator.
   * Changes may cause incorrect behavior and will be lost if the code is regenerated.
   */
  
  // Copyright (c) Microsoft Corporation.
  // Licensed under the MIT License.
  /**
   * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed.
   *
   * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed.
   * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateUserAssignedEncryptionIdentityWithCMK.json
   */
  const { StorageManagementClient } = require("@azure/arm-storage");
  const { DefaultAzureCredential } = require("@azure/identity");
  
  async function storageAccountCreateUserAssignedEncryptionIdentityWithCmk() {
    const subscriptionId = "{subscription-id}";
    const resourceGroupName = "res9101";
    const accountName = "sto4445";
    const parameters = {
      encryption: {
        encryptionIdentity: {
          encryptionUserAssignedIdentity:
            "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}",
        },
        keySource: "Microsoft.Keyvault",
        keyVaultProperties: {
          keyName: "wrappingKey",
          keyVaultUri: "https://myvault8569.vault.azure.net",
          keyVersion: "",
        },
        services: {
          blob: { enabled: true, keyType: "Account" },
          file: { enabled: true, keyType: "Account" },
        },
      },
      identity: {
        type: "UserAssigned",
        userAssignedIdentities: {
          "/subscriptions/{subscriptionId}/resourceGroups/res9101/providers/MicrosoftManagedIdentity/userAssignedIdentities/{managedIdentityName}":
            {},
        },
      },
      kind: "Storage",
      location: "eastus",
      sku: { name: "Standard_LRS" },
    };
    const credential = new DefaultAzureCredential();
    const client = new StorageManagementClient(credential, subscriptionId);
    const result = await client.storageAccounts.beginCreateAndWait(
      resourceGroupName,
      accountName,
      parameters
    );
    console.log(result);
  }
  
  storageAccountCreateUserAssignedEncryptionIdentityWithCmk().catch(console.error);
  