#Azure Storage
- Instalar jq para parsear json (https://stedolan.github.io/jq/)
- Instalar python con pip https://www.python.org/downloads/windows/ (win)
- Instalar blobxfer
pip install blobxfer
- Instalar nvm https://github.com/creationix/nvm (lnx) https://github.com/coreybutler/nvm-windows (win)
nvm arch 64
nvm install 4.4.2
nvm use 4.4.2
- Instalar las azure xplat
npm install -g azure-cli
azure --version
azure config mode arm
azure login
- Abrir https://aka.ms/devicelogin e introducir el código después de autentificar.
- Abrir http://portal.azure.com
azure account list
##Crear storage account y blob container
SET prefix=ciberadodemo
SET resource_group=%prefix%
SET region=northeurope
SET storage_account=%prefix%vmstorage
SET storage_container=artifacts
SET vnet_name=%prefix%vnet
SET subnet_name=%prefix%subnet
##Creación del contenedor en un resource group
azure group create %resource_group% %region%
azure storage account create ^
--location %region% ^
--resource-group %resource_group% ^
--type LRS ^
%storage_account%
##Obtener las keys del storage account
azure storage account keys list --json ^
--resource-group %resource_group% ^
%storage_account% ^
| jq ".key1"
REM TODO: for magic here
SET account_key=<your_account_key>
##Crear el container
azure storage container create ^
--container %storage_container% ^
--account-name %storage_account% ^
--account-key %account_key%
##Generar el token Shared Access Signature
azure storage container sas create ^
--json ^
--account-name %storage_account% ^
--container %storage_container% ^
--account-key %account_key% ^
--permissions rwl ^
--expiry 2016-05-22 ^
| jq ".sas"
SET sas=<your_sas_token>
##Comprobar la transferencia de archivos
echo "Hola mundo" > test.txt
blobxfer %storage_account% %storage_container% test.txt --saskey %sas%
azure storage blob list ^
%storage_container% ^
--account-name %storage_account% ^
--sas %sas% ^
--json
azure storage blob download ^
%storage_container% ^
--account-name %storage_account% ^
test.txt .\test-copy.txt ^
--sas %sas% ^
--json
##Extra ball: obtener la connection string del account
azure storage account connectionstring show ^
--json ^
%storage_account% ^
--resource-group %resource_group% ^
| jq ".string"
SET cstring=<account_connection_string>