336 lines
25 KiB
JavaScript
336 lines
25 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 The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
|
|
*
|
|
* @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
|
|
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/StorageAccountEnableAD.json
|
|
*/
|
|
function storageAccountEnableAd() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const subscriptionId = "{subscription-id}";
|
|
const resourceGroupName = "res9407";
|
|
const accountName = "sto8596";
|
|
const parameters = {
|
|
azureFilesIdentityBasedAuthentication: {
|
|
activeDirectoryProperties: {
|
|
accountType: "User",
|
|
azureStorageSid: "S-1-5-21-2400535526-2334094090-2402026252-0012",
|
|
domainGuid: "aebfc118-9fa9-4732-a21f-d98e41a77ae1",
|
|
domainName: "adtest.com",
|
|
domainSid: "S-1-5-21-2400535526-2334094090-2402026252",
|
|
forestName: "adtest.com",
|
|
netBiosDomainName: "adtest.com",
|
|
samAccountName: "sam12498"
|
|
},
|
|
directoryServiceOptions: "AD"
|
|
}
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StorageManagementClient(credential, subscriptionId);
|
|
const result = yield client.storageAccounts.update(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountEnableAd().catch(console.error);
|
|
/**
|
|
* This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
|
|
*
|
|
* @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
|
|
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/StorageAccountEnableCMK.json
|
|
*/
|
|
function storageAccountEnableCmk() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const subscriptionId = "{subscription-id}";
|
|
const resourceGroupName = "res9407";
|
|
const accountName = "sto8596";
|
|
const parameters = {
|
|
encryption: {
|
|
keySource: "Microsoft.Keyvault",
|
|
keyVaultProperties: {
|
|
keyName: "wrappingKey",
|
|
keyVaultUri: "https://myvault8569.vault.azure.net",
|
|
keyVersion: ""
|
|
},
|
|
services: {
|
|
blob: { enabled: true, keyType: "Account" },
|
|
file: { enabled: true, keyType: "Account" }
|
|
}
|
|
}
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StorageManagementClient(credential, subscriptionId);
|
|
const result = yield client.storageAccounts.update(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountEnableCmk().catch(console.error);
|
|
/**
|
|
* This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
|
|
*
|
|
* @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
|
|
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/StorageAccountUpdate.json
|
|
*/
|
|
function storageAccountUpdate() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const subscriptionId = "{subscription-id}";
|
|
const resourceGroupName = "res9407";
|
|
const accountName = "sto8596";
|
|
const parameters = {
|
|
allowBlobPublicAccess: false,
|
|
allowSharedKeyAccess: true,
|
|
defaultToOAuthAuthentication: false,
|
|
encryption: {
|
|
keySource: "Microsoft.Storage",
|
|
services: {
|
|
blob: { enabled: true, keyType: "Account" },
|
|
file: { enabled: true, keyType: "Account" }
|
|
}
|
|
},
|
|
isLocalUserEnabled: true,
|
|
isSftpEnabled: true,
|
|
keyPolicy: { keyExpirationPeriodInDays: 20 },
|
|
minimumTlsVersion: "TLS1_2",
|
|
networkRuleSet: {
|
|
defaultAction: "Allow",
|
|
resourceAccessRules: [
|
|
{
|
|
resourceId: "/subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace",
|
|
tenantId: "72f988bf-86f1-41af-91ab-2d7cd011db47"
|
|
}
|
|
]
|
|
},
|
|
routingPreference: {
|
|
publishInternetEndpoints: true,
|
|
publishMicrosoftEndpoints: true,
|
|
routingChoice: "MicrosoftRouting"
|
|
},
|
|
sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StorageManagementClient(credential, subscriptionId);
|
|
const result = yield client.storageAccounts.update(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountUpdate().catch(console.error);
|
|
/**
|
|
* This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
|
|
*
|
|
* @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
|
|
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/StorageAccountUpdateAllowedCopyScopeToAAD.json
|
|
*/
|
|
function storageAccountUpdateAllowedCopyScopeToAad() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const subscriptionId = "{subscription-id}";
|
|
const resourceGroupName = "res9407";
|
|
const accountName = "sto8596";
|
|
const parameters = {
|
|
allowBlobPublicAccess: false,
|
|
allowSharedKeyAccess: true,
|
|
allowedCopyScope: "AAD",
|
|
encryption: {
|
|
keySource: "Microsoft.Storage",
|
|
services: {
|
|
blob: { enabled: true, keyType: "Account" },
|
|
file: { enabled: true, keyType: "Account" }
|
|
}
|
|
},
|
|
keyPolicy: { keyExpirationPeriodInDays: 20 },
|
|
minimumTlsVersion: "TLS1_2",
|
|
networkRuleSet: {
|
|
defaultAction: "Allow",
|
|
resourceAccessRules: [
|
|
{
|
|
resourceId: "/subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace",
|
|
tenantId: "72f988bf-86f1-41af-91ab-2d7cd011db47"
|
|
}
|
|
]
|
|
},
|
|
routingPreference: {
|
|
publishInternetEndpoints: true,
|
|
publishMicrosoftEndpoints: true,
|
|
routingChoice: "MicrosoftRouting"
|
|
},
|
|
sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StorageManagementClient(credential, subscriptionId);
|
|
const result = yield client.storageAccounts.update(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountUpdateAllowedCopyScopeToAad().catch(console.error);
|
|
/**
|
|
* This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
|
|
*
|
|
* @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
|
|
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/StorageAccountUpdateDisablePublicNetworkAccess.json
|
|
*/
|
|
function storageAccountUpdateDisablePublicNetworkAccess() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const subscriptionId = "{subscription-id}";
|
|
const resourceGroupName = "res9407";
|
|
const accountName = "sto8596";
|
|
const parameters = {
|
|
allowBlobPublicAccess: false,
|
|
allowSharedKeyAccess: true,
|
|
encryption: {
|
|
keySource: "Microsoft.Storage",
|
|
services: {
|
|
blob: { enabled: true, keyType: "Account" },
|
|
file: { enabled: true, keyType: "Account" }
|
|
}
|
|
},
|
|
keyPolicy: { keyExpirationPeriodInDays: 20 },
|
|
minimumTlsVersion: "TLS1_2",
|
|
networkRuleSet: {
|
|
defaultAction: "Allow",
|
|
resourceAccessRules: [
|
|
{
|
|
resourceId: "/subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace",
|
|
tenantId: "72f988bf-86f1-41af-91ab-2d7cd011db47"
|
|
}
|
|
]
|
|
},
|
|
publicNetworkAccess: "Disabled",
|
|
routingPreference: {
|
|
publishInternetEndpoints: true,
|
|
publishMicrosoftEndpoints: true,
|
|
routingChoice: "MicrosoftRouting"
|
|
},
|
|
sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StorageManagementClient(credential, subscriptionId);
|
|
const result = yield client.storageAccounts.update(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountUpdateDisablePublicNetworkAccess().catch(console.error);
|
|
/**
|
|
* This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
|
|
*
|
|
* @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
|
|
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/StorageAccountUpdateUserAssignedEncryptionIdentityWithCMK.json
|
|
*/
|
|
function storageAccountUpdateUserAssignedEncryptionIdentityWithCmk() {
|
|
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",
|
|
sku: { name: "Standard_LRS" }
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StorageManagementClient(credential, subscriptionId);
|
|
const result = yield client.storageAccounts.update(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountUpdateUserAssignedEncryptionIdentityWithCmk().catch(console.error);
|
|
/**
|
|
* This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
|
|
*
|
|
* @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
|
|
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/StorageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.json
|
|
*/
|
|
function storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const subscriptionId = "{subscription-id}";
|
|
const resourceGroupName = "res131918";
|
|
const accountName = "sto131918";
|
|
const parameters = {
|
|
encryption: {
|
|
encryptionIdentity: {
|
|
encryptionFederatedIdentityClientId: "3109d1c4-a5de-4d84-8832-feabb916a4b6",
|
|
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",
|
|
sku: { name: "Standard_LRS" }
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StorageManagementClient(credential, subscriptionId);
|
|
const result = yield client.storageAccounts.update(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId().catch(console.error);
|
|
/**
|
|
* This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
|
|
*
|
|
* @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
|
|
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/StorageAccountUpdateWithImmutabilityPolicy.json
|
|
*/
|
|
function storageAccountUpdateWithImmutabilityPolicy() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const subscriptionId = "{subscription-id}";
|
|
const resourceGroupName = "res9407";
|
|
const accountName = "sto8596";
|
|
const parameters = {
|
|
immutableStorageWithVersioning: {
|
|
enabled: true,
|
|
immutabilityPolicy: {
|
|
allowProtectedAppendWrites: true,
|
|
immutabilityPeriodSinceCreationInDays: 15,
|
|
state: "Locked"
|
|
}
|
|
}
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new StorageManagementClient(credential, subscriptionId);
|
|
const result = yield client.storageAccounts.update(resourceGroupName, accountName, parameters);
|
|
console.log(result);
|
|
});
|
|
}
|
|
storageAccountUpdateWithImmutabilityPolicy().catch(console.error);
|
|
//# sourceMappingURL=storageAccountsUpdateSample.js.map
|