開始使用 Azure Stack Hub 儲存體開發工具Get started with Azure Stack Hub storage development tools
Microsoft Azure Stack Hub 提供一組儲存體服務,包括 Blob、資料表和佇列儲存體。Microsoft Azure Stack Hub provides a set of storage services that includes blob, table, and queue storage.
使用本文作為開始使用 Azure Stack Hub 儲存體開發工具的指南。Use this article as a guide to get started using Azure Stack Hub storage development tools. 您可以在對應的 Azure 儲存體教學課程中,找到更詳細的資訊和範例程式碼。You can find more detailed information and sample code in corresponding Azure storage tutorials.
注意
Azure Stack Hub 儲存體與 Azure 儲存體之間有一些差異,包括每個平台的特定需求。There are differences between Azure Stack Hub storage and Azure storage, including specific requirements for each platform. 例如,Azure Stack Hub 有特定的用戶端程式庫和端點尾碼需求。For example, there are specific client libraries and endpoint suffix requirements for Azure Stack Hub. 如需詳細資訊,請參閱 Azure Stack Hub 儲存體:差異與注意事項。For more information, see Azure Stack Hub storage: Differences and considerations.
Azure 用戶端程式庫Azure client libraries
對於儲存體用戶端程式庫,請留意與 REST API 相容的版本。For the storage client libraries, be aware of the version that is compatible with the REST API. 您也必須在程式碼中指定 Azure Stack Hub 端點。You must also specify the Azure Stack Hub endpoint in your code.
2008更新2008 update
透過編輯器安裝 PHP 用戶端 - 目前Install PHP client via Composer - current
若要透過編輯器安裝:(以 Blob 為例)。To install via Composer: (take the blob as an example).
使用下列程式碼,在專案的根目錄中建立名為 composer.js 的檔案:Create a file named composer.json in the root of the project with following code:
{ "require": { "Microsoft/azure-storage-blob":"1.2.0" } }
將 composer.phar 下載到專案根目錄中。Download composer.phar to the project root.
執行:
php composer.phar install
。Run:php composer.phar install
.
2005更新2005 update
透過編輯器安裝 PHP 用戶端 - 目前Install PHP client via Composer - current
若要透過編輯器安裝:(以 Blob 為例)。To install via Composer: (take the blob as an example).
使用下列程式碼,在專案的根目錄中建立名為 composer.js 的檔案:Create a file named composer.json in the root of the project with following code:
{ "require": { "Microsoft/azure-storage-blob":"1.2.0" } }
將 composer.phar 下載到專案根目錄中。Download composer.phar to the project root.
執行:
php composer.phar install
。Run:php composer.phar install
.
舊版 (1811 至2002更新) Previous versions (1811 to 2002 update)
透過編輯器安裝 PHP 用戶端 - 目前Install PHP client via Composer - current
若要透過編輯器安裝:(以 Blob 為例)。To install via Composer: (take the blob as an example).
使用下列程式碼,在專案的根目錄中建立名為 composer.js 的檔案:Create a file named composer.json in the root of the project with following code:
{ "require": { "Microsoft/azure-storage-blob":"1.2.0" } }
將 composer.phar 下載到專案根目錄中。Download composer.phar to the project root.
執行:
php composer.phar install
。Run:php composer.phar install
.
舊版 (1802 至 1809 更新)Previous versions (1802 to 1809 update)
透過編輯器安裝 PHP 用戶端 - 先前Install PHP client via Composer - previous
若要透過編輯器安裝:(以 Blob 為例)。To install via Composer: (take blob as example).
使用下列程式碼,在專案的根目錄中建立名為 composer.js 的檔案:Create a file named composer.json in the root of the project with following code:
{ "require": { "Microsoft/azure-storage-blob":"1.0.0" } }
將 composer.phar 下載到專案根目錄中。Download composer.phar to the project root.
執行:
php composer.phar install
。Run:php composer.phar install
.
端點宣告Endpoint declaration
Azure Stack Hub 端點包含兩個部分:區域的名稱和 Azure Stack Hub 網域。An Azure Stack Hub endpoint includes two parts: the name of a region and the Azure Stack Hub domain. 在 Azure Stack 開發套件中,預設端點是 local.azurestack.external。In the Azure Stack Development Kit, the default endpoint is local.azurestack.external. 如果不確定您的端點,請連絡您的雲端系統管理員。Contact your cloud admin if you're not sure about your endpoint.
範例Examples
.NET.NET
若是 Azure Stack Hub,在 app.config 檔案中會指定端點尾碼:For Azure Stack Hub, the endpoint suffix is specified in the app.config file:
<add key="StorageConnectionString"
value="DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=mykey;
EndpointSuffix=local.azurestack.external;" />
JavaJava
若是 Azure Stack Hub,在連接字串設定中會指定端點尾碼:For Azure Stack Hub, the endpoint suffix is specified in the setup of connection string:
public static final String storageConnectionString =
"DefaultEndpointsProtocol=http;" +
"AccountName=your_storage_account;" +
"AccountKey=your_storage_account_key;" +
"EndpointSuffix=local.azurestack.external";
Node.jsNode.js
若是 Azure Stack Hub,在宣告執行個體中會指定端點尾碼:For Azure Stack Hub, the endpoint suffix is specified in the declaration instance:
var blobSvc = azure.createBlobService('myaccount', 'mykey',
'myaccount.blob.local.azurestack.external');
C++C++
若是 Azure Stack Hub,在連接字串設定中會指定端點尾碼:For Azure Stack Hub, the endpoint suffix is specified in the setup of connection string:
const utility::string_t storage_connection_string(U("DefaultEndpointsProtocol=https;
AccountName=your_storage_account;
AccountKey=your_storage_account_key;
EndpointSuffix=local.azurestack.external"));
PHPPHP
若是 Azure Stack Hub,在連接字串設定中會指定端點尾碼:For Azure Stack Hub, the endpoint suffix is specified in the setup of connection string:
$connectionString = 'BlobEndpoint=https://<storage account name>.blob.local.azurestack.external/;
QueueEndpoint=https:// <storage account name>.queue.local.azurestack.external/;
TableEndpoint=https:// <storage account name>.table.local.azurestack.external/;
AccountName=<storage account name>;AccountKey=<storage account key>'
PythonPython
若是 Azure Stack Hub,在宣告執行個體中會指定端點尾碼:For Azure Stack Hub, the endpoint suffix is specified in the declaration instance:
block_blob_service = BlockBlobService(account_name='myaccount',
account_key='mykey',
endpoint_suffix='local.azurestack.external')
RubyRuby
若是 Azure Stack Hub,在連接字串設定中會指定端點尾碼:For Azure Stack Hub, the endpoint suffix is specified in the setup of connection string:
set
AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=https;
AccountName=myaccount;
AccountKey=mykey;
EndpointSuffix=local.azurestack.external
Blob 儲存體Blob storage
下列 Azure Blob 儲存體教學課程適用於 Azure Stack Hub。The following Azure Blob storage tutorials are applicable to Azure Stack Hub. 請注意先前範例一節中所述的 Azure Stack Hub 特定端點尾碼需求。Note the specific endpoint suffix requirement for Azure Stack Hub described in the previous Examples section.
- 以 .NET 開始使用 Azure Blob 儲存體Get started with Azure Blob storage using .NET
- 如何使用 Java 的 Blob 儲存體How to use Blob storage from Java
- 如何使用 Node.js 的 Blob 儲存體How to use Blob storage from Node.js
- 如何使用 c + + 的 Blob 儲存體How to use Blob storage from C++
- 如何使用 PHP 的 Blob 儲存體How to use Blob storage from PHP
- 如何使用 Python 的 Azure Blob 儲存體How to use Azure Blob storage from Python
- 如何使用 Ruby 的 Blob 儲存體How to use Blob storage from Ruby
佇列儲存體Queue storage
下列 Azure 佇列儲存體教學課程適用於 Azure Stack Hub。The following Azure Queue storage tutorials are applicable to Azure Stack Hub. 請注意先前範例一節中所述的 Azure Stack Hub 特定端點尾碼需求。Note the specific endpoint suffix requirement for Azure Stack Hub described in the previous Examples section.
- 以 .NET 開始使用 Azure 佇列儲存體Get started with Azure Queue storage using .NET
- 如何使用 Java 的佇列儲存體How to use Queue storage from Java
- 如何使用 Node.js 的佇列儲存體How to use Queue storage from Node.js
- 如何使用 c + + 的佇列儲存體How to use Queue storage from C++
- 如何使用 PHP 的佇列儲存體How to use Queue storage from PHP
- 如何使用 Python 的佇列儲存體How to use Queue storage from Python
- 如何使用 Ruby 的佇列儲存體How to use Queue storage from Ruby
資料表儲存體Table storage
下列 Azure 資料表儲存體教學課程適用於 Azure Stack Hub。The following Azure Table storage tutorials are applicable to Azure Stack Hub. 請注意先前範例一節中所述的 Azure Stack Hub 特定端點尾碼需求。Note the specific endpoint suffix requirement for Azure Stack Hub described in the previous Examples section.
- 以 .NET 開始使用 Azure 表格儲存體Get started with Azure Table storage using .NET
- 如何使用 Java 的表格儲存體How to use Table storage from Java
- 如何從 Node.js 使用 Azure 資料表儲存體How to use Azure Table storage from Node.js
- 如何從 C++ 使用資料表儲存體How to use Table storage from C++
- 如何使用 PHP 的表格儲存體How to use Table storage from PHP
- 如何在 Python 中使用資料表儲存體How to use Table storage in Python
- 如何使用 Ruby 的表格儲存體How to use Table storage from Ruby