Azure Scripts:
Azure > Storage account > File shares > SMB File share
To connect to this Azure file share from Windows, run the PowerShell commands from a normal (not elevated) PowerShell terminal:
$connectTestResult = Test-NetConnection -ComputerName mystorageaccsree.file.core.windows.net -Port 445
if ($connectTestResult.TcpTestSucceeded) {
# Save the password so the drive will persist on reboot
cmd.exe /C "cmdkey
/add:`"mystorageaccsree.file.core.windows.net`"
/user:`"localhost\mystorageaccsree`" /pass:`"zmKoauV41A9Lt9PUwt+xTSDeQaySe2yfldlhJPVU2gYfY0KWL7VB+OXvtO73WQTUkm7GRXmwC90j+ASt7Vdj/Q==`""
# Mount the drive
New-PSDrive -Name Z -PSProvider FileSystem -Root "\\mystorageaccsree.file.core.windows.net\myfile123" -Persist
} else {
Write-Error -Message "Unable to reach the Azure storage
account via port 445. Check to make sure your organization or ISP is not
blocking port 445, or use Azure P2S VPN, Azure S2S VPN, or Express Route to
tunnel SMB traffic over a different port."
}
###
###
#AZURE BASH SCRIPT:
#Create a blob storage using CLI:
#az storage account create -n <storage account name> -g <resource group name> -l westus --sku Standard_LRS
az storage account create -n storageaccountsree123 -g rg_eastus_52415_1_171886025677 -l westus --sku Standard_LRS
#Create a Container using CLI:
#az storage container create --account-name <storage account name> --name <container name>
az storage container create --account-name storageaccountsree123 --name containersree123
#Upload a blob on to storage account:
echo This is a sample html file > sample.html
#az storage blob upload --account-name <storage account name> --container-name <container name> --name sample.html --file sample.html
az storage blob upload --account-name storageaccountsree123 --container-name containersree123 --name sample.html --file sample.html
#Give public access to the blob file:
#az storage container set-permission --account-name <storage account name> --name <container name> --public-access blob
az storage container set-permission --account-name storageaccountsree123 --name containersree123 --public-access blob
#List and download the blob using CLI:
#az storage blob list --account-name <storage account name> --container-name <container name> --output table
az storage blob list --account-name storageaccountsree123 --container-name containersree123 --output table
#az storage blob download --account-name <storage account name> --container-name <container name> --name sample.html --file sample2.html
az storage blob download --account-name storageaccountsree123 --container-name containersree123 --name sample.html --file sample2.html
###
#https://aka.ms/downloadazcopy-v10-windows
azcopy login
azcopy copy "C:\testfolder1" "https://whizstoragesree123.blob.core.windows.net/democontainer" --recursive=true
azcopy sync "C:\testfolder1" "https://whizstoragesree123.blob.core.windows.net/democontainer" --recursive=true
schtasks /CREATE /SC minute /MO 5 /TN "AzCopy Script" /TR C:\testfolder1\script.bat
###
###
###
###
###
###
###
###
No comments:
Post a Comment