Azure File SMB3.0文件共享服务(2)
使用Powershell创建文件共享
Azure的文件存储结构如下所示,最基本的文件存储包含存储账号,文件共享,在文件共享下面你可以建立文件目录,上传文件:
在开始使用Powershell创建文件共享之前,你需要获得Azure的账号,安装powershell,配置你的账号,请参考我以前的博客,在此不再赘述。
- 首先,创建Azure storage account,需要设置你的storage账号的名称,以及你的存储账号是创建在那个region,比如中国东部:
$StorageAccountName="mystorageacctfile"
$Location="China East"
New-AzureStorageAccount –StorageAccountName $StorageAccountName -Location $Location
- 通过命令得到你的当前存储账号的key,设置你的当前订阅,和当前订阅的存储账号:
#得到存储的key值
Get-AzureStorageKey -StorageAccountName $StorageAccountName
#设置当前订阅的默认存储
Set-AzureSubscription -CurrentStorageAccountName $StorageAccountName -SubscriptionId $SubscriptionID
- 通过Powershell来创建Azure file 的文件存储
#获得Azure存储的上下文
$ctx=New-AzureStorageContext $StorageAccountName $StorageAccountKey
#创建Azure file共享服务
$share = New-AzureStorageShare $filesharename -Context $ctx
#列出当前Azure文件共享服务
Get-AzureStorageShare -Context $ctx -Name $filesharename
- 登陆到Azure的portal上,你可以看到已经配置好的存储账号和文件服务:
- 如果你希望你的文件服务实现跨地区的冗余,你可以在配置项进行配置:
- 到目前为止文件共享服务已经创建完毕了,那么我们使用Powershell来使用文件共享服务,包括创建目录,上传一个文件,列出文件:
#创建文件共享目录
New-AzureStorageDirectory -Share $share -Path logs
#上传一个文件到文件共享目录
Set-AzureStorageFileContent -Share $share -Source d:\hdinsight.publishsettings -Path logs
# 列出目录下的所有文件
Get-AzureStorageFile -Share $share -Path logs | Get-AzureStorageFile
# List all your files
Get-AzureStorageFile -Share $share -Path logs | Get-AzureStorageFile
- 和其他存储类似,你可以使用Powershell在File和File之间,File和Blob之间进行拷贝:
Start-AzureStorageFileCopy -SrcShareName $filesharename -SrcFilePath "logs/hdinsight.publishsettings" -DestShareName $filesharenamenew -DestFilePath "logs/hdinsight.publishsettings" -Context $ctx -DestContext $ctx
所有相关测试脚本已经更新到了github,你可以下载源代码测试:
https://github.com/kingliantop/azurelabs/blob/master/storage/StorageFileShare.ps1
Azure File SMB3.0文件共享服务(2)的更多相关文章
- Azure File SMB3.0文件共享服务(3)
在Windows上使用Azure文件共享服务 之前简单介绍过,你可以通过SMB 3.0协议,将Azure文件共享挂载在本地,就如使用一个网络驱动器是一样的,但需要注意不同版本的Windows对于SMB ...
- Azure File SMB3.0文件共享服务(4)
在Linux上使用Azure文件共享服务 使用SMB 3.0从用户自己的数据连接到Azure,需要加密连接,但目前的Linux SMB客户端都暂时都不支持,Linux的开源社区正在努力将该功能添加到L ...
- Azure File SMB3.0文件共享服务(1)
Azure Storage File是Azure推出的文件共享服务,目前的版本同时支持SMB 2.1和SMB 3.0协议.文件共享服务非常适合那些希望把自己数据中心中使用文件共享的应用程序,在云端需要 ...
- Azure File SMB3.0文件共享服务(5)
使用Java管理Azure文件共享服务 Azure文件共享服务提供了多种方式的访问接口,包括Powershell,.Net, Java, Python等等,本章主要介绍如何使用Java来访问A ...
- Windows Azure文件共享服务--File Service
部署在Windows Azure上的虚拟机之间如何共享文件?例如:Web Server A和Web Server B组成负载均衡集群,两个服务器需要一个共享目录来存储用户上传的文件.通常,大家可能首先 ...
- Microsoft Azure File 服务简介
我们非常高兴地宣布在微软Azure中国区推出 Microsoft Azure File 服务预览版.Azure File 服务使用标准 SMB 2.1 协议提供文件共享.Azure 中运行的应用程序现 ...
- Azure File文件共享(6):使用Python开发
Azure文件共享服务提供了多种方式的访问接口,包括Powershell,.Net, Java, Python等等,本章主要介绍如何使用Python来访问Azure File存储. 关于Python环 ...
- Azure AD Domain Service(二)为域服务中的机器配置 Azure File Share 磁盘共享
一,引言 Azure File Share 是支持两种认证方式的! 1)Active Directory 2)Storage account key 记得上次分析的 "Azure File ...
- Windows Azure Storage (20) 使用Azure File实现共享文件夹
<Windows Azure Platform 系列文章目录> Update 2016-4-14.在Azure VM配置FTP和IIS,请参考: http://blogs.iis.net/ ...
随机推荐
- [转]MySQL 5.6 全局事务 ID(GTID)实现原理(一)
原文作者:淘长源 原文连接:http://qing.blog.sina.com.cn/1757661907/68c3cad333002qhe.html 转载注明以上信息 MySQL 5.6 的新特 ...
- Cows(poj 2481 树状数组)
Cows Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 15301 Accepted: 5095 Description ...
- Logging in Java
Common logging: Log4j1仅仅作为一个实际的日志框架,commons-logging作为门面,统一各种日志框架的混乱格局 基本的commons logging Dependency: ...
- HQL(Hibernate Query language)语言
现在有两张表:student(学生表),classroom(教室表). //对象 Student 对应 student 表中有四个字段,分别是:id,name,age,classroom; publi ...
- LinqToSql 小例子
namespace LinqToSqlDemo.Test { class Program { // 数据连接文本 private static DataClasses1DataContext data ...
- awk 处理
find . -type f | awk '{print $NF}' | grep pdf$ |grep -v preview | while read A; do ls -ltr $A| awk ' ...
- 开源欣赏wordpress之文章新增页面如何实现。
本地网址http://localhost/wordpress/wp-admin/post-new.php 进而找到post-new.php页面. 进入之后, require_once( dirname ...
- jquery中使用offset()获得的div的left=0,top=0
写东西的时候要获取div的left和top,但怎么也取不到值都为0,但在chrome的console下是可以取到值的, 瞬间就纳闷了,于是乎就在网上找各种方法,大家一般的问题可能都是要获取的div被隐 ...
- C# Switch is Type
常规用法: Type t = sender.GetType(); if (t == typeof(Button)) { var realObj = (Button)sender; // Do Some ...
- LeeCode-Single Number II
Given an array of integers, every element appears three times except for one. Find that single one. ...