Una cuenta de Azure Storage contiene todos los objetos de datos de Azure Storage: blobs, archivos, colas, tablas y discos.An Azure storage account contains all of your Azure Storage data objects: blobs, files, queues, tables, and disks.La cuenta de almacenamiento proporciona un espacio de nombres único para los datos de Azure Storage que es accesible desde cualquier lugar del mundo a través de HTTP o HTTPS.The storage account provides a unique namespace for your Azure Storage data that is accessible from anywhere in the world over HTTP or HTTPS.Los datos de la cuenta de Azure Storage son duraderos y altamente disponibles, seguros y escalables a gran escala.Data in your Azure storage account is durable and highly available, secure, and massively scalable.
Este artículo se ha actualizado para usar el módulo Az de Azure PowerShell.This article has been updated to use the Azure Az PowerShell module.El módulo Az de PowerShell es el módulo de PowerShell que se recomienda para interactuar con Azure.The Az PowerShell module is the recommended PowerShell module for interacting with Azure.Para empezar a trabajar con el módulo Az de PowerShell, consulte Instalación de Azure PowerShell.To get started with the Az PowerShell module, see Install Azure PowerShell.Para más información sobre cómo migrar al módulo Az de PowerShell, consulte Migración de Azure PowerShell de AzureRM a Az.To learn how to migrate to the Az PowerShell module, see Migrate Azure PowerShell from AzureRM to Az.
PrerrequisitosPrerequisites
Si no tiene una suscripción a Azure, cree una cuenta gratuita antes de empezar.If you don't have an Azure subscription, create a free account before you begin.
Para crear una cuenta de almacenamiento de Azure con PowerShell, asegúrese de que ha instalado la versión 0.7 o posterior del módulo Az de Azure PowerShell.To create an Azure storage account with PowerShell, make sure you have installed Azure PowerShell module Az version 0.7 or later.Para obtener más información, consulte Presentación del módulo Az de Azure PowerShell.For more information, see Introducing the Azure PowerShell Az module.
Para saber cuál es su versión actual, ejecute el comando siguiente:To find your current version, run the following command:
Puede iniciar sesión en Azure y ejecutar los comandos de la CLI de Azure de dos maneras:You can sign in to Azure and run Azure CLI commands in one of two ways:
Puede ejecutar los comandos de la CLI desde Azure Portal, en Azure Cloud Shell.You can run CLI commands from within the Azure portal, in Azure Cloud Shell.
Puede instalar la CLI y ejecutar sus comandos en local.You can install the CLI and run CLI commands locally.
Uso de Azure Cloud ShellUse Azure Cloud Shell
Azure Cloud Shell es un shell de Bash gratuito que puede ejecutarse directamente en Azure Portal.Azure Cloud Shell is a free Bash shell that you can run directly within the Azure portal.La CLI de Azure está preinstalada y configurada para su uso con la cuenta.The Azure CLI is pre-installed and configured to use with your account.Haga clic en el botón Cloud Shell del menú situado en la sección superior derecha de Azure Portal:Click the Cloud Shell button on the menu in the upper-right section of the Azure portal:
El botón inicia un shell interactivo que se puede usar para ejecutar los pasos de este artículo de procedimientos:The button launches an interactive shell that you can use to run the steps outlined in this how-to article:
Instalación local de la CLIInstall the CLI locally
También puede instalar y usar la CLI de Azure localmente.You can also install and use the Azure CLI locally.Los ejemplos de este artículo requieren la CLI de Azure, versión 2.0.4 o posterior.The examples in this article require Azure CLI version 2.0.4 or later.Ejecute az --version para buscar la versión instalada.Run az --version to find your installed version.Si necesita instalarla o actualizarla, consulte Instalación de la CLI de Azure.If you need to install or upgrade, see Install the Azure CLI.
Inicie sesión en la suscripción de Azure con el comando Connect-AzAccount y siga las instrucciones que aparecen en pantalla para autenticarse.Sign in to your Azure subscription with the Connect-AzAccount command and follow the on-screen directions to authenticate.
Connect-AzAccount
Para iniciar Azure Cloud Shell, inicie sesión en Azure Portal.To launch Azure Cloud Shell, sign in to the Azure portal.
Para iniciar sesión en la instalación local de la CLI, ejecute el comando az login:To log into your local installation of the CLI, run the az login command:
az login
N/DN/A
Crear una cuenta de almacenamientoCreate a storage account
Cada cuenta de almacenamiento debe pertenecer a un grupo de recursos de Azure.Every storage account must belong to an Azure resource group.Un grupo de recursos es un contenedor lógico para agrupar servicios de Azure.A resource group is a logical container for grouping your Azure services.Al crear una cuenta de almacenamiento, puede elegir entre crear un grupo de recursos o usar uno existente.When you create a storage account, you have the option to either create a new resource group, or use an existing resource group.En este artículo se muestra cómo crear un nuevo grupo de recursos.This article shows how to create a new resource group.
Una cuenta de almacenamiento de uso general v2 proporciona acceso a todos los servicios de Azure Storage: Blob, File, Queue, Table y Disk.A general-purpose v2 storage account provides access to all of the Azure Storage services: blobs, files, queues, tables, and disks.Los pasos indicados aquí crean una cuenta de almacenamiento de uso general v2, pero los pasos para crear cualquier otro tipo de cuenta de almacenamiento son similares.The steps outlined here create a general-purpose v2 storage account, but the steps to create any type of storage account are similar.Para obtener más información sobre los tipos de cuentas de almacenamiento y otros parámetros de la cuenta de almacenamiento, consulte Introducción a las cuentas de Azure Storage.For more information about types of storage accounts and other storage account settings, see Azure storage account overview.
Para crear una cuenta de almacenamiento de uso general v2 en Azure Portal, siga estos pasos:To create a general-purpose v2 storage account in the Azure portal, follow these steps:
En el menú de Azure Portal, seleccione Todos los servicios.On the Azure portal menu, select All services.En la lista de recursos, escriba Cuentas de almacenamiento.In the list of resources, type Storage Accounts.Cuando comience a escribir, la lista se filtrará en función de la entrada.As you begin typing, the list filters based on your input.Seleccione Cuentas de almacenamiento.Select Storage Accounts.
En la ventana Cuentas de almacenamiento que aparece, elija Agregar.On the Storage Accounts window that appears, choose Add.
En la pestaña Aspectos básicos, seleccione la suscripción en la que se va a crear la cuenta de almacenamiento.On the Basics tab, select the subscription in which to create the storage account.
En el campo Grupo de recursos, seleccione el grupo de recursos deseado o cree uno nuevo.Under the Resource group field, select your desired resource group, or create a new resource group.Para más información sobre los grupos de recursos de Azure, consulte Información general de Azure Resource Manager.For more information on Azure resource groups, see Azure Resource Manager overview.
Después, escriba un nombre para la cuenta de almacenamiento.Next, enter a name for your storage account.El nombre que elija debe ser único en Azure.The name you choose must be unique across Azure.El nombre también debe tener una longitud de entre 3 y 24 caracteres, y solo puede contener números y letras minúsculas.The name also must be between 3 and 24 characters in length, and may include only numbers and lowercase letters.
Seleccione una ubicación para la cuenta de almacenamiento o utilice la ubicación predeterminada.Select a location for your storage account, or use the default location.
Seleccione un nivel de rendimiento.Select a performance tier.El valor predeterminado es Estándar.The default tier is Standard.
En el campo Tipo de cuenta, elija Storage V2 (general-purpose v2) [Storage V2 (uso general v2)].Set the Account kind field to Storage V2 (general-purpose v2).
Especifique cómo se replicará la cuenta de almacenamiento.Specify how the storage account will be replicated.La opción de replicación predeterminada es Almacenamiento con redundancia geográfica con acceso de lectura (RA-GRS) .The default replication option is Read-access geo-redundant storage (RA-GRS).Para más información acerca de las opciones de replicación disponibles, consulte Redundancia de Azure Storage.For more information about available replication options, see Azure Storage redundancy.
Hay otras opciones disponibles en las pestañas Redes, Protección de datos, Opciones avanzadas y Etiquetas.Additional options are available on the Networking, Data protection, Advanced, and Tags tabs.Para utilizar Azure Data Lake Storage, elija la pestaña Opciones avanzadas y, después, establezca Espacio de nombres jerárquico en Habilitado.To use Azure Data Lake Storage, choose the Advanced tab, and then set Hierarchical namespace to Enabled.Para más información, consulte Introducción a Azure Data Lake Storage Gen2.For more information, see Azure Data Lake Storage Gen2 Introduction
Seleccione Revisar y crear para revisar la configuración de la cuenta de almacenamiento y crear la cuenta.Select Review + Create to review your storage account settings and create the account.
Seleccione Crear.Select Create.
En la imagen siguiente se muestra la configuración de la pestaña Aspectos básicos de una nueva cuenta de almacenamiento:The following image shows the settings on the Basics tab for a new storage account:
En primer lugar, cree un grupo de recursos con PowerShell mediante el comando New-AzResourceGroup:First, create a new resource group with PowerShell using the New-AzResourceGroup command:
# put resource group in a variable so you can use the same group name going forward,
# without hard-coding it repeatedly
$resourceGroup = "storage-resource-group"
$location = "westus"
New-AzResourceGroup -Name $resourceGroup -Location $location
Si no está seguro de qué región especificar para el parámetro -Location, puede recuperar una lista de regiones admitidas para la suscripción con el comando Get-AzLocation:If you're not sure which region to specify for the -Location parameter, you can retrieve a list of supported regions for your subscription with the Get-AzLocation command:
Get-AzLocation | select Location
Luego, para crear una cuenta de almacenamiento de uso general v2 con almacenamiento con redundancia local con acceso de lectura (RA-GRS), use el comando New-AzStorageAccount.Next, create a general-purpose v2 storage account with read-access geo-redundant storage (RA-GRS) by using the New-AzStorageAccount command.Recuerde que el nombre de la cuenta de almacenamiento debe ser único en Azure, así que reemplace el valor de marcador de posición entre corchetes por su propio valor único:Remember that the name of your storage account must be unique across Azure, so replace the placeholder value in brackets with your own unique value:
Si planea usar Azure Data Lake Storage, incluya -EnableHierarchicalNamespace $True en esta lista de parámetros.If you plan to use Azure Data Lake Storage, include -EnableHierarchicalNamespace $True in this list of parameters.
Para crear una cuenta de almacenamiento de uso general v2 con otra opción de replicación, sustituya el valor deseado de la tabla siguiente por el parámetro SkuName.To create a general-purpose v2 storage account with a different replication option, substitute the desired value in the table below for the SkuName parameter.
Opción ReplicaciónReplication option
Parámetro SkuNameSkuName parameter
Almacenamiento con redundancia local (LRS)Locally redundant storage (LRS)
Standard_LRSStandard_LRS
Almacenamiento con redundancia de zona (ZRS)Zone-redundant storage (ZRS)
Standard_ZRSStandard_ZRS
Almacenamiento con redundancia geográfica (GRS)Geo-redundant storage (GRS)
Standard_GRSStandard_GRS
Almacenamiento con redundancia geográfica con acceso de lectura (GRS)Read-access geo-redundant storage (GRS)
Standard_RAGRSStandard_RAGRS
Almacenamiento con redundancia de zona geográfica (GZRS)Geo-zone-redundant storage (GZRS)
Standard_GZRSStandard_GZRS
Almacenamiento con redundancia de zona geográfica con acceso de lectura (RA-GZRS)Read-access geo-zone-redundant storage (RA-GZRS)
Standard_RAGZRSStandard_RAGZRS
Primero, cree un grupo de recursos con la CLI de Azure mediante el comando az group create.First, create a new resource group with Azure CLI using the az group create command.
az group create \
--name storage-resource-group \
--location westus
Si no está seguro de qué región especificar para el parámetro --location, puede recuperar una lista de regiones admitidas para la suscripción con el comando az account list-locations.If you're not sure which region to specify for the --location parameter, you can retrieve a list of supported regions for your subscription with the az account list-locations command.
az account list-locations \
--query "[].{Region:name}" \
--out table
Luego, para crear una cuenta de almacenamiento de uso general v2 con almacenamiento con redundancia local con acceso de lectura (RA-GRS), use el comando az storage account create.Next, create a general-purpose v2 storage account with read-access geo-redundant storage by using the az storage account create command.Recuerde que el nombre de la cuenta de almacenamiento debe ser único en Azure, así que reemplace el valor de marcador de posición entre corchetes por su propio valor único:Remember that the name of your storage account must be unique across Azure, so replace the placeholder value in brackets with your own unique value:
Si planea usar Azure Data Lake Storage, incluya --enable-hierarchical-namespace true en esta lista de parámetros.If you plan to use Azure Data Lake Storage, include --enable-hierarchical-namespace true in this list of parameters.
Para crear una cuenta de almacenamiento de uso general v2 con otra opción de replicación, sustituya el valor deseado de la tabla siguiente por el parámetro sku.To create a general-purpose v2 storage account with a different replication option, substitute the desired value in the table below for the sku parameter.
Opción ReplicaciónReplication option
Parámetro skusku parameter
Almacenamiento con redundancia local (LRS)Locally redundant storage (LRS)
Standard_LRSStandard_LRS
Almacenamiento con redundancia de zona (ZRS)Zone-redundant storage (ZRS)
Standard_ZRSStandard_ZRS
Almacenamiento con redundancia geográfica (GRS)Geo-redundant storage (GRS)
Standard_GRSStandard_GRS
Almacenamiento con redundancia geográfica con acceso de lectura (GRS)Read-access geo-redundant storage (GRS)
Standard_RAGRSStandard_RAGRS
Almacenamiento con redundancia de zona geográfica (GZRS)Geo-zone-redundant storage (GZRS)
Standard_GZRSStandard_GZRS
Almacenamiento con redundancia de zona geográfica con acceso de lectura (RA-GZRS)Read-access geo-zone-redundant storage (RA-GZRS)
Standard_RAGZRSStandard_RAGZRS
Puede usar Azure PowerShell o la CLI de Azure para implementar una plantilla de Resource Manager y crear así una cuenta de almacenamiento.You can use either Azure PowerShell or Azure CLI to deploy a Resource Manager template to create a storage account.La plantilla empleada en este artículo de procedimientos proviene de Plantillas de inicio rápido de Azure Resource Manager.The template used in this how-to article is from Azure Resource Manager quickstart templates.Para ejecutar los scripts, seleccione Pruébelo para abrir Azure Cloud Shell.To run the scripts, select Try it to open the Azure Cloud Shell.Para pegar el script, haga clic con el botón derecho en el shell y, a continuación, seleccione Pegar.To paste the script, right-click the shell, and then select Paste.
$resourceGroupName = Read-Host -Prompt "Enter the Resource Group name"
$location = Read-Host -Prompt "Enter the location (i.e. centralus)"
New-AzResourceGroup -Name $resourceGroupName -Location "$location"
New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateUri "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-storage-account-create/azuredeploy.json"
echo "Enter the Resource Group name:" &&
read resourceGroupName &&
echo "Enter the location (i.e. centralus):" &&
read location &&
az group create --name $resourceGroupName --location "$location" &&
az deployment group create --resource-group $resourceGroupName --template-file "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-storage-account-create/azuredeploy.json"
Nota
Esta plantilla sirve solo como ejemplo.This template serves only as an example.Hay muchas opciones de una cuenta de almacenamiento que no se configuran como parte de esta plantilla.There are many storage account settings that aren't configured as part of this template.Por ejemplo, si desea utilizar Azure Data Lake Storage, debe modificar esta plantilla estableciendo la propiedad isHnsEnabledad del objeto StorageAccountPropertiesCreateParameters en true.For example, if you want to use Azure Data Lake Storage, you would modify this template by setting the isHnsEnabledad property of the StorageAccountPropertiesCreateParameters object to true.
Para obtener información sobre cómo modificar esta plantilla o crear otras nuevas, consulte:To learn how to modify this template or create new ones, see:
Eliminar una cuenta de almacenamientoDelete a storage account
Si se elimina la cuenta de almacenamiento, se elimina toda la cuenta, incluidos todos los datos de la cuenta. Esta acción no se puede deshacer.Deleting a storage account deletes the entire account, including all data in the account, and cannot be undone.
az storage account delete --name <storage-account> --resource-group <resource-group>
Para eliminar la cuenta de almacenamiento, use Azure PowerShell o la CLI de Azure.To delete the storage account, use either Azure PowerShell or Azure CLI.
$storageResourceGroupName = Read-Host -Prompt "Enter the resource group name"
$storageAccountName = Read-Host -Prompt "Enter the storage account name"
Remove-AzStorageAccount -Name $storageAccountName -ResourceGroupName $storageResourceGroupName
echo "Enter the resource group name:" &&
read resourceGroupName &&
echo "Enter the storage account name:" &&
read storageAccountName &&
az storage account delete --name storageAccountName --resource-group resourceGroupName
Como alternativa, puede eliminar el grupo de recursos, que elimina la cuenta de almacenamiento y otros recursos de ese grupo de recursos.Alternately, you can delete the resource group, which deletes the storage account and any other resources in that resource group.Para obtener más información sobre cómo eliminar un grupo de recursos, consulte Eliminación del grupo de recursos y los recursos.For more information about deleting a resource group, see Delete resource group and resources.
Advertencia
No es posible restaurar una cuenta de almacenamiento eliminada ni recuperar el contenido que contenía antes de la eliminación.It's not possible to restore a deleted storage account or retrieve any of the content that it contained before deletion.Asegúrese de hacer una copia de seguridad de cualquier contenido que desee guardar antes de eliminar la cuenta.Be sure to back up anything you want to save before you delete the account.Esto también es verdad para los recursos de la cuenta: cuando se elimina un blob, tabla, cola o archivo, este se eliminará definitivamente.This also holds true for any resources in the account—once you delete a blob, table, queue, or file, it is permanently deleted.
Si intenta eliminar una cuenta de almacenamiento asociada a una máquina virtual de Azure, puede obtener un error sobre que la cuenta de almacenamiento aún está usándose.If you try to delete a storage account associated with an Azure virtual machine, you may get an error about the storage account still being in use.Para obtener ayuda para solucionar este error, consulte Solución de errores al eliminar las cuentas de almacenamiento.For help troubleshooting this error, see Troubleshoot errors when you delete storage accounts.