In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
Create a file share using Powershell
The file storage structure of Azure is as follows. The most basic file storage includes storage account and file sharing. Under file sharing, you can create a file directory and upload files:
Before you start using Powershell to create file sharing, you need to get an Azure account, install powershell, and configure your account. Please refer to my previous blog, which I won't repeat here.
First of all, to create an Azure storage account, you need to set the name of your storage account and the region in which your storage account is created, such as East China:
$StorageAccountName= "mystorageacctfile"
$Location= "China East"
New-AzureStorageAccount-StorageAccountName $StorageAccountName-Location $Location
Get the key of your current storage account through the command, set your current subscription, and the storage account of the current subscription:
# get the stored key value
Get-AzureStorageKey-StorageAccountName $StorageAccountName
# set the default storage for the current subscription
Set-AzureSubscription-CurrentStorageAccountName $StorageAccountName-SubscriptionId $SubscriptionID
Create file storage for Azure file through Powershell
# get the context of Azure storage
$ctx=New-AzureStorageContext $StorageAccountName $StorageAccountKey
# create an Azure file shared service
$share = New-AzureStorageShare $filesharename-Context $ctx
# list current Azure file sharing services
Get-AzureStorageShare-Context $ctx-Name $filesharename
Log in to Azure's portal and you can see the configured storage account and file service:
If you want your file service to achieve cross-regional redundancy, you can configure it in the configuration item:
So far, the file sharing service has been created, so we use Powershell to use the file sharing service, including creating a directory, uploading a file, and listing files:
# create a file share directory
New-AzureStorageDirectory-Share $share-Path logs
# upload a file to the file share directory
Set-AzureStorageFileContent-Share $share-Source d:\ hdinsight.publishsettings-Path logs
# list all files in the directory
Get-AzureStorageFile-Share $share-Path logs | Get-AzureStorageFile
# List all your files
Get-AzureStorageFile-Share $share-Path logs | Get-AzureStorageFile
Like other storage, you can use powershell to copy between File and File, and between File and Blob:
Start-AzureStorageFileCopy-SrcShareName $filesharename-SrcFilePath "logs/hdinsight.publishsettings"-DestShareName $filesharenamenew-DestFilePath "logs/hdinsight.publishsettings"-Context $ctx-DestContext $ctx
All relevant test scripts have been updated to github, and you can download the source code tests:
Https://github.com/kingliantop/azurelabs/blob/master/storage/StorageFileShare.ps1
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
Start the system with the character interface by default
© 2024 shulou.com SLNews company. All rights reserved.