Skip to content

Commit 6f93822

Browse files
authored
Merge pull request #200448 from normesta/azurite
Adding table examples
2 parents 3c0e181 + 95499d9 commit 6f93822

File tree

1 file changed

+39
-6
lines changed

1 file changed

+39
-6
lines changed

articles/storage/common/storage-use-azurite.md

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: The Azurite open-source emulator provides a free local environment
44
author: normesta
55

66
ms.author: normesta
7-
ms.date: 12/03/2021
7+
ms.date: 06/03/2022
88
ms.service: storage
99
ms.subservice: common
1010
ms.topic: how-to
@@ -490,7 +490,7 @@ You can pass the following connection strings to the [Azure SDKs](https://aka.ms
490490

491491
The full connection string is:
492492

493-
`DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;`
493+
`DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10001/devstoreaccount1;`
494494

495495
To connect to the blob service only, the connection string is:
496496

@@ -500,11 +500,15 @@ To connect to the queue service only, the connection string is:
500500

501501
`DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;`
502502

503+
To connect to the table service only, the connection string is:
504+
505+
`DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;TableEndpoint=http://127.0.0.1:10001/devstoreaccount1;`
506+
503507
#### HTTPS connection strings
504508

505509
The full HTTPS connection string is:
506510

507-
`DefaultEndpointsProtocol=https;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=https://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=https://127.0.0.1:10001/devstoreaccount1;`
511+
`DefaultEndpointsProtocol=https;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=https://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=https://127.0.0.1:10001/devstoreaccount1;TableEndpoint=https://127.0.0.1:10001/devstoreaccount1;`
508512

509513
To use the blob service only, the HTTPS connection string is:
510514

@@ -514,9 +518,13 @@ To use the queue service only, the HTTPS connection string is:
514518

515519
`DefaultEndpointsProtocol=https;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;QueueEndpoint=https://127.0.0.1:10001/devstoreaccount1;`
516520

521+
To use the table service only, the HTTPS connection string is:
522+
523+
`DefaultEndpointsProtocol=https;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;TableEndpoint=https://127.0.0.1:10001/devstoreaccount1;`
524+
517525
If you used `dotnet dev-certs` to generate your self-signed certificate, use the following connection string.
518526

519-
`DefaultEndpointsProtocol=https;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=https://localhost:10000/devstoreaccount1;QueueEndpoint=https://localhost:10001/devstoreaccount1;`
527+
`DefaultEndpointsProtocol=https;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=https://localhost:10000/devstoreaccount1;QueueEndpoint=https://localhost:10001/devstoreaccount1;TableEndpoint=https://localhost:10001/devstoreaccount1;`
520528

521529
Update the connection string when using [custom storage accounts and keys](#custom-storage-accounts-and-keys).
522530

@@ -542,7 +550,7 @@ var client = new BlobContainerClient(
542550

543551
// With connection string
544552
var client = new BlobContainerClient(
545-
"DefaultEndpointsProtocol=https;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=https://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=https://127.0.0.1:10001/devstoreaccount1;", "container-name"
553+
"DefaultEndpointsProtocol=https;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=https://127.0.0.1:10000/devstoreaccount1;", "container-name"
546554
);
547555

548556
// With account name and key
@@ -564,7 +572,7 @@ var client = new QueueClient(
564572

565573
// With connection string
566574
var client = new QueueClient(
567-
"DefaultEndpointsProtocol=https;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=https://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=https://127.0.0.1:10001/devstoreaccount1;", "queue-name"
575+
"DefaultEndpointsProtocol=https;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;QueueEndpoint=https://127.0.0.1:10001/devstoreaccount1;", "queue-name"
568576
);
569577

570578
// With account name and key
@@ -574,6 +582,28 @@ var client = new QueueClient(
574582
);
575583
```
576584

585+
#### Azure Table Storage
586+
587+
You can also instantiate a TableClient or TableServiceClient.
588+
589+
```csharp
590+
// With table URL and DefaultAzureCredential
591+
var client = new Client(
592+
new Uri("https://127.0.0.1:10001/devstoreaccount1/table-name"), new DefaultAzureCredential()
593+
);
594+
595+
// With connection string
596+
var client = new TableClient(
597+
"DefaultEndpointsProtocol=https;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;TableEndpoint=https://127.0.0.1:10001/devstoreaccount1;", "table-name"
598+
);
599+
600+
// With account name and key
601+
var client = new TableClient(
602+
new Uri("https://127.0.0.1:10001/devstoreaccount1/table-name"),
603+
new StorageSharedKeyCredential("devstoreaccount1", "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==")
604+
);
605+
```
606+
577607
### Microsoft Azure Storage Explorer
578608

579609
You can use Storage Explorer to view the data stored in Azurite.
@@ -623,10 +653,13 @@ The following files and folders may be created in the workspace location when in
623653

624654
- `__blobstorage__` - Directory containing Azurite blob service persisted binary data
625655
- `__queuestorage__` - Directory containing Azurite queue service persisted binary data
656+
- `__tablestorage__` - Directory containing Azurite table service persisted binary data
626657
- `__azurite_db_blob__.json` - Azurite blob service metadata file
627658
- `__azurite_db_blob_extent__.json` - Azurite blob service extent metadata file
628659
- `__azurite_db_queue__.json` - Azurite queue service metadata file
629660
- `__azurite_db_queue_extent__.json` - Azurite queue service extent metadata file
661+
- `__azurite_db_table__.json` - Azurite table service metadata file
662+
- `__azurite_db_table_extent__.json` - Azurite table service extent metadata file
630663

631664
To clean up Azurite, delete above files and folders and restart the emulator.
632665

0 commit comments

Comments
 (0)