522 lines
31 KiB
JavaScript
522 lines
31 KiB
JavaScript
/*
|
|
* 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.
|
|
*/
|
|
import { __awaiter } from "tslib";
|
|
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
import { StorageManagementClient } from "@azure/arm-storage";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
/**
|
|
* 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-09-01/examples/NfsV3AccountCreate.json
|
|
*/
|
|
function nfsV3AccountCreate() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const subscriptionId = "{subscription-id}";
|
|
const resourceGroupName = "res9101";
|
|
const accountName = "sto4445";
|
|
const parameters = {
|
|
isHnsEnabled: true,
|
|
enableNfsV3: true,
|
|
kind: "BlockBlobStorage",
|
|
location: "eastus",
|
|
networkRuleSet: {
|
|
bypass: "AzureServices",
|
|
defaultAction: "Allow",
|
|
ipRules: [],
|
|
virtualNetworkRules: [
|
|
{
|
|
virtualNetworkResourceId: "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.Network/virtualNetworks/net123/subnets/subnet12"
|
|
}
|
|
]
|
|
},
|
|
sku: { name: "Premium_LRS" },
|
|
enableHttpsTrafficOnly: false
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StorageManagementClient(credential, subscriptionId);
|
|
const result = yield client.storageAccounts.beginCreateAndWait(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
nfsV3AccountCreate().catch(console.error);
|
|
/**
|
|
* 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-09-01/examples/StorageAccountCreate.json
|
|
*/
|
|
function storageAccountCreate() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const subscriptionId = "{subscription-id}";
|
|
const resourceGroupName = "res9101";
|
|
const accountName = "sto4445";
|
|
const parameters = {
|
|
allowBlobPublicAccess: false,
|
|
allowSharedKeyAccess: true,
|
|
defaultToOAuthAuthentication: false,
|
|
encryption: {
|
|
keySource: "Microsoft.Storage",
|
|
requireInfrastructureEncryption: false,
|
|
services: {
|
|
blob: { enabled: true, keyType: "Account" },
|
|
file: { enabled: true, keyType: "Account" }
|
|
}
|
|
},
|
|
extendedLocation: { name: "losangeles001", type: "EdgeZone" },
|
|
isHnsEnabled: true,
|
|
isSftpEnabled: true,
|
|
keyPolicy: { keyExpirationPeriodInDays: 20 },
|
|
kind: "Storage",
|
|
location: "eastus",
|
|
minimumTlsVersion: "TLS1_2",
|
|
routingPreference: {
|
|
publishInternetEndpoints: true,
|
|
publishMicrosoftEndpoints: true,
|
|
routingChoice: "MicrosoftRouting"
|
|
},
|
|
sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" },
|
|
sku: { name: "Standard_GRS" },
|
|
tags: { key1: "value1", key2: "value2" }
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StorageManagementClient(credential, subscriptionId);
|
|
const result = yield client.storageAccounts.beginCreateAndWait(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountCreate().catch(console.error);
|
|
/**
|
|
* 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-09-01/examples/StorageAccountCreateAllowedCopyScopeToAAD.json
|
|
*/
|
|
function storageAccountCreateAllowedCopyScopeToAad() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const subscriptionId = "{subscription-id}";
|
|
const resourceGroupName = "res9101";
|
|
const accountName = "sto4445";
|
|
const parameters = {
|
|
allowBlobPublicAccess: false,
|
|
allowSharedKeyAccess: true,
|
|
allowedCopyScope: "AAD",
|
|
encryption: {
|
|
keySource: "Microsoft.Storage",
|
|
requireInfrastructureEncryption: false,
|
|
services: {
|
|
blob: { enabled: true, keyType: "Account" },
|
|
file: { enabled: true, keyType: "Account" }
|
|
}
|
|
},
|
|
isHnsEnabled: true,
|
|
keyPolicy: { keyExpirationPeriodInDays: 20 },
|
|
kind: "Storage",
|
|
location: "eastus",
|
|
minimumTlsVersion: "TLS1_2",
|
|
routingPreference: {
|
|
publishInternetEndpoints: true,
|
|
publishMicrosoftEndpoints: true,
|
|
routingChoice: "MicrosoftRouting"
|
|
},
|
|
sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" },
|
|
sku: { name: "Standard_GRS" },
|
|
tags: { key1: "value1", key2: "value2" }
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StorageManagementClient(credential, subscriptionId);
|
|
const result = yield client.storageAccounts.beginCreateAndWait(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountCreateAllowedCopyScopeToAad().catch(console.error);
|
|
/**
|
|
* 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-09-01/examples/StorageAccountCreateAllowedCopyScopeToPrivateLink.json
|
|
*/
|
|
function storageAccountCreateAllowedCopyScopeToPrivateLink() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const subscriptionId = "{subscription-id}";
|
|
const resourceGroupName = "res9101";
|
|
const accountName = "sto4445";
|
|
const parameters = {
|
|
allowBlobPublicAccess: false,
|
|
allowSharedKeyAccess: true,
|
|
allowedCopyScope: "PrivateLink",
|
|
encryption: {
|
|
keySource: "Microsoft.Storage",
|
|
requireInfrastructureEncryption: false,
|
|
services: {
|
|
blob: { enabled: true, keyType: "Account" },
|
|
file: { enabled: true, keyType: "Account" }
|
|
}
|
|
},
|
|
isHnsEnabled: true,
|
|
keyPolicy: { keyExpirationPeriodInDays: 20 },
|
|
kind: "Storage",
|
|
location: "eastus",
|
|
minimumTlsVersion: "TLS1_2",
|
|
routingPreference: {
|
|
publishInternetEndpoints: true,
|
|
publishMicrosoftEndpoints: true,
|
|
routingChoice: "MicrosoftRouting"
|
|
},
|
|
sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" },
|
|
sku: { name: "Standard_GRS" },
|
|
tags: { key1: "value1", key2: "value2" }
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StorageManagementClient(credential, subscriptionId);
|
|
const result = yield client.storageAccounts.beginCreateAndWait(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountCreateAllowedCopyScopeToPrivateLink().catch(console.error);
|
|
/**
|
|
* 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-09-01/examples/StorageAccountCreateDisallowPublicNetworkAccess.json
|
|
*/
|
|
function storageAccountCreateDisallowPublicNetworkAccess() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const subscriptionId = "{subscription-id}";
|
|
const resourceGroupName = "res9101";
|
|
const accountName = "sto4445";
|
|
const parameters = {
|
|
allowBlobPublicAccess: false,
|
|
allowSharedKeyAccess: true,
|
|
encryption: {
|
|
keySource: "Microsoft.Storage",
|
|
requireInfrastructureEncryption: false,
|
|
services: {
|
|
blob: { enabled: true, keyType: "Account" },
|
|
file: { enabled: true, keyType: "Account" }
|
|
}
|
|
},
|
|
extendedLocation: { name: "losangeles001", type: "EdgeZone" },
|
|
isHnsEnabled: true,
|
|
keyPolicy: { keyExpirationPeriodInDays: 20 },
|
|
kind: "Storage",
|
|
location: "eastus",
|
|
minimumTlsVersion: "TLS1_2",
|
|
publicNetworkAccess: "Disabled",
|
|
routingPreference: {
|
|
publishInternetEndpoints: true,
|
|
publishMicrosoftEndpoints: true,
|
|
routingChoice: "MicrosoftRouting"
|
|
},
|
|
sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" },
|
|
sku: { name: "Standard_GRS" },
|
|
tags: { key1: "value1", key2: "value2" }
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StorageManagementClient(credential, subscriptionId);
|
|
const result = yield client.storageAccounts.beginCreateAndWait(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountCreateDisallowPublicNetworkAccess().catch(console.error);
|
|
/**
|
|
* 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-09-01/examples/StorageAccountCreateDnsEndpointTypeToAzureDnsZone.json
|
|
*/
|
|
function storageAccountCreateDnsEndpointTypeToAzureDnsZone() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const subscriptionId = "{subscription-id}";
|
|
const resourceGroupName = "res9101";
|
|
const accountName = "sto4445";
|
|
const parameters = {
|
|
allowBlobPublicAccess: false,
|
|
allowSharedKeyAccess: true,
|
|
defaultToOAuthAuthentication: false,
|
|
dnsEndpointType: "AzureDnsZone",
|
|
encryption: {
|
|
keySource: "Microsoft.Storage",
|
|
requireInfrastructureEncryption: false,
|
|
services: {
|
|
blob: { enabled: true, keyType: "Account" },
|
|
file: { enabled: true, keyType: "Account" }
|
|
}
|
|
},
|
|
extendedLocation: { name: "losangeles001", type: "EdgeZone" },
|
|
isHnsEnabled: true,
|
|
isSftpEnabled: true,
|
|
keyPolicy: { keyExpirationPeriodInDays: 20 },
|
|
kind: "Storage",
|
|
location: "eastus",
|
|
minimumTlsVersion: "TLS1_2",
|
|
routingPreference: {
|
|
publishInternetEndpoints: true,
|
|
publishMicrosoftEndpoints: true,
|
|
routingChoice: "MicrosoftRouting"
|
|
},
|
|
sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" },
|
|
sku: { name: "Standard_GRS" },
|
|
tags: { key1: "value1", key2: "value2" }
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StorageManagementClient(credential, subscriptionId);
|
|
const result = yield client.storageAccounts.beginCreateAndWait(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountCreateDnsEndpointTypeToAzureDnsZone().catch(console.error);
|
|
/**
|
|
* 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-09-01/examples/StorageAccountCreateDnsEndpointTypeToStandard.json
|
|
*/
|
|
function storageAccountCreateDnsEndpointTypeToStandard() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const subscriptionId = "{subscription-id}";
|
|
const resourceGroupName = "res9101";
|
|
const accountName = "sto4445";
|
|
const parameters = {
|
|
allowBlobPublicAccess: false,
|
|
allowSharedKeyAccess: true,
|
|
defaultToOAuthAuthentication: false,
|
|
dnsEndpointType: "Standard",
|
|
encryption: {
|
|
keySource: "Microsoft.Storage",
|
|
requireInfrastructureEncryption: false,
|
|
services: {
|
|
blob: { enabled: true, keyType: "Account" },
|
|
file: { enabled: true, keyType: "Account" }
|
|
}
|
|
},
|
|
extendedLocation: { name: "losangeles001", type: "EdgeZone" },
|
|
isHnsEnabled: true,
|
|
isSftpEnabled: true,
|
|
keyPolicy: { keyExpirationPeriodInDays: 20 },
|
|
kind: "Storage",
|
|
location: "eastus",
|
|
minimumTlsVersion: "TLS1_2",
|
|
routingPreference: {
|
|
publishInternetEndpoints: true,
|
|
publishMicrosoftEndpoints: true,
|
|
routingChoice: "MicrosoftRouting"
|
|
},
|
|
sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" },
|
|
sku: { name: "Standard_GRS" },
|
|
tags: { key1: "value1", key2: "value2" }
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StorageManagementClient(credential, subscriptionId);
|
|
const result = yield client.storageAccounts.beginCreateAndWait(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountCreateDnsEndpointTypeToStandard().catch(console.error);
|
|
/**
|
|
* 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-09-01/examples/StorageAccountCreateEnablePublicNetworkAccess.json
|
|
*/
|
|
function storageAccountCreateEnablePublicNetworkAccess() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const subscriptionId = "{subscription-id}";
|
|
const resourceGroupName = "res9101";
|
|
const accountName = "sto4445";
|
|
const parameters = {
|
|
allowBlobPublicAccess: false,
|
|
allowSharedKeyAccess: true,
|
|
encryption: {
|
|
keySource: "Microsoft.Storage",
|
|
requireInfrastructureEncryption: false,
|
|
services: {
|
|
blob: { enabled: true, keyType: "Account" },
|
|
file: { enabled: true, keyType: "Account" }
|
|
}
|
|
},
|
|
extendedLocation: { name: "losangeles001", type: "EdgeZone" },
|
|
isHnsEnabled: true,
|
|
keyPolicy: { keyExpirationPeriodInDays: 20 },
|
|
kind: "Storage",
|
|
location: "eastus",
|
|
minimumTlsVersion: "TLS1_2",
|
|
publicNetworkAccess: "Enabled",
|
|
routingPreference: {
|
|
publishInternetEndpoints: true,
|
|
publishMicrosoftEndpoints: true,
|
|
routingChoice: "MicrosoftRouting"
|
|
},
|
|
sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" },
|
|
sku: { name: "Standard_GRS" },
|
|
tags: { key1: "value1", key2: "value2" }
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StorageManagementClient(credential, subscriptionId);
|
|
const result = yield client.storageAccounts.beginCreateAndWait(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountCreateEnablePublicNetworkAccess().catch(console.error);
|
|
/**
|
|
* 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-09-01/examples/StorageAccountCreatePremiumBlockBlobStorage.json
|
|
*/
|
|
function storageAccountCreatePremiumBlockBlobStorage() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const subscriptionId = "{subscription-id}";
|
|
const resourceGroupName = "res9101";
|
|
const accountName = "sto4445";
|
|
const parameters = {
|
|
allowSharedKeyAccess: true,
|
|
encryption: {
|
|
keySource: "Microsoft.Storage",
|
|
requireInfrastructureEncryption: false,
|
|
services: {
|
|
blob: { enabled: true, keyType: "Account" },
|
|
file: { enabled: true, keyType: "Account" }
|
|
}
|
|
},
|
|
kind: "BlockBlobStorage",
|
|
location: "eastus",
|
|
minimumTlsVersion: "TLS1_2",
|
|
sku: { name: "Premium_LRS" },
|
|
tags: { key1: "value1", key2: "value2" }
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StorageManagementClient(credential, subscriptionId);
|
|
const result = yield client.storageAccounts.beginCreateAndWait(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountCreatePremiumBlockBlobStorage().catch(console.error);
|
|
/**
|
|
* 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-09-01/examples/StorageAccountCreateUserAssignedEncryptionIdentityWithCMK.json
|
|
*/
|
|
function storageAccountCreateUserAssignedEncryptionIdentityWithCmk() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
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 = yield client.storageAccounts.beginCreateAndWait(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountCreateUserAssignedEncryptionIdentityWithCmk().catch(console.error);
|
|
/**
|
|
* 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-09-01/examples/StorageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.json
|
|
*/
|
|
function storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const subscriptionId = "{subscription-id}";
|
|
const resourceGroupName = "res131918";
|
|
const accountName = "sto131918";
|
|
const parameters = {
|
|
encryption: {
|
|
encryptionIdentity: {
|
|
encryptionFederatedIdentityClientId: "f83c6b1b-4d34-47e4-bb34-9d83df58b540",
|
|
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 = yield client.storageAccounts.beginCreateAndWait(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId().catch(console.error);
|
|
/**
|
|
* 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-09-01/examples/StorageAccountCreateWithImmutabilityPolicy.json
|
|
*/
|
|
function storageAccountCreateWithImmutabilityPolicy() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const subscriptionId = "{subscription-id}";
|
|
const resourceGroupName = "res9101";
|
|
const accountName = "sto4445";
|
|
const parameters = {
|
|
extendedLocation: { name: "losangeles001", type: "EdgeZone" },
|
|
immutableStorageWithVersioning: {
|
|
enabled: true,
|
|
immutabilityPolicy: {
|
|
allowProtectedAppendWrites: true,
|
|
immutabilityPeriodSinceCreationInDays: 15,
|
|
state: "Unlocked"
|
|
}
|
|
},
|
|
kind: "Storage",
|
|
location: "eastus",
|
|
sku: { name: "Standard_GRS" }
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StorageManagementClient(credential, subscriptionId);
|
|
const result = yield client.storageAccounts.beginCreateAndWait(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountCreateWithImmutabilityPolicy().catch(console.error);
|
|
//# sourceMappingURL=storageAccountsCreateSample.js.map
|