標籤:azure storage 檔案分享權限設定 new-azurestorage
今天就簡單講一下如何在Azure Storage帳號建立檔案分享權限設定,並掛載在Azure VM上。(順便吐槽一下,中國Azure官方文檔能不能翻譯好一下,直譯global azure 一回事,技術文檔的校正完全沒做好)
我們先在Azure上建立一個測試vm,具體可以參考:http://gshao.blog.51cto.com/3512873/1344846
1. 在Azure 上建立一個Storage帳號;
650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M00/71/F0/wKiom1Xa_5OgRvfoAAHXUtwYrto540.jpg" height="504" />
2.登陸window azure powershell,配置下檔案分享權限設定;
輸入:
Get-AzurePublishSettingsFile -Environment AzureChinaCloud
mport-AzurePublishSettingsFile “****.publishsettings”(設定檔的路徑)
650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M01/71/F0/wKiom1Xa_5SQror4AAGksW8JSUE425.jpg" height="95" />
配置儲存帳號上下文
$ctx=New-AzureStorageContext –StorageAccountName account-name –StorageAccountKey account-key -environment "AzureChinaCloud"(中國區才要加這個,global不用)
建立共用資料夾
$s=New-AzureStorageShare sharefiles(共用資料夾名) -Context $ctx
650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/71/F0/wKiom1Xa_5aiHoDXAAEu86TcMJQ328.jpg" height="61" />
可以用命令查看file的情況:
輸入:Get-AzureStorageFile –Share $s
650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M00/71/F0/wKiom1Xa_5fRdbFSAABKUHB4-II308.jpg" height="50" />
3.在Azure VM掛載檔案分享權限設定;
在powershell輸入:
cmdkey /add:<storage-account-name>.file.core.windows.net /user:<storage-account-name> /pass:<storage-account-key>
這個是為了儲存憑據,以便重啟vm不會導致檔案分享權限設定的登陸憑據丟失
650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M01/71/F0/wKiom1Xa_5nicy-SAAFGhQf5LdY841.jpg" height="76" />
添加檔案分享權限設定儲存:
net use z: \\ <storage-account>.file.core.chinacloudapi.cn\共用資料夾名 /u:<storage-account> <storage-account-key>
650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/71/F0/wKiom1Xa_5vztLwcAAEWBhntLzo722.jpg" height="72" />
650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M00/71/F0/wKiom1Xa_53ADuQ0AAEVAlWxHG8181.jpg" height="257" />
嗯,猜一下這個檔案夾大概多少儲存空間呢。答案是5TB
650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M01/71/F0/wKiom1Xa_5_hLSpnAADRW9wL4mA858.jpg" height="288" />
但是我蠻奇怪,中國azure的說法
(原話是
)
具體可以看一下中國Azure關於檔案分享權限設定儲存連結:http://www.windowsazure.cn/documentation/articles/storage-dotnet-how-to-use-files
本文出自 “gs_hao” 部落格,謝絕轉載!
Window Azure 之Azure Storage檔案分享權限設定儲存