Skip to content

Commit 587461b

Browse files
switching order on readme (#15426)
1 parent 51ba505 commit 587461b

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

sdk/tables/azure-data-tables/README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,6 @@ az storage account show -n mystorageaccount -g MyResourceGroup --query "primaryE
6363
#### Types of credentials
6464
The `credential` parameter may be provided in a number of different forms, depending on the type of authorization you wish to use:
6565

66-
##### Creating the client from a SAS token
67-
To use a [shared access signature (SAS) token][azure_sas_token], provide the token as a string. If your account URL includes the SAS token, omit the credential parameter. You can generate a SAS token from the Azure Portal under [Shared access signature](https://docs.microsoft.com/rest/api/storageservices/create-service-sas) or use one of the `generate_*_sas()`
68-
functions to create a sas token for the account or table:
69-
70-
```python
71-
from datetime import datetime, timedelta
72-
from azure.data.tables import TableServiceClient, generate_account_sas, ResourceTypes, AccountSasPermissions
73-
74-
sas_token = generate_account_sas(
75-
account_name="<account-name>",
76-
account_key="<account-access-key>",
77-
resource_types=ResourceTypes(service=True),
78-
permission=AccountSasPermissions(read=True),
79-
expiry=datetime.utcnow() + timedelta(hours=1)
80-
)
81-
82-
table_service_client = TableServiceClient(account_url="https://<my_account_name>.table.core.windows.net", credential=sas_token)
83-
```
84-
8566
##### Creating the client from a shared key
8667
To use an account [shared key][azure_shared_key] (aka account key or access key), provide the key as a string. This can be found in the [Azure Portal][azure_portal_account_url] under the "Access Keys" section or by running the following Azure CLI command:
8768

@@ -110,6 +91,25 @@ The connection string to your account can be found in the Azure Portal under the
11091
az storage account show-connection-string -g MyResourceGroup -n MyStorageAccount
11192
```
11293

94+
##### Creating the client from a SAS token
95+
To use a [shared access signature (SAS) token][azure_sas_token], provide the token as a string. If your account URL includes the SAS token, omit the credential parameter. You can generate a SAS token from the Azure Portal under [Shared access signature](https://docs.microsoft.com/rest/api/storageservices/create-service-sas) or use one of the `generate_*_sas()`
96+
functions to create a sas token for the account or table:
97+
98+
```python
99+
from datetime import datetime, timedelta
100+
from azure.data.tables import TableServiceClient, generate_account_sas, ResourceTypes, AccountSasPermissions
101+
102+
sas_token = generate_account_sas(
103+
account_name="<account-name>",
104+
account_key="<account-access-key>",
105+
resource_types=ResourceTypes(service=True),
106+
permission=AccountSasPermissions(read=True),
107+
expiry=datetime.utcnow() + timedelta(hours=1)
108+
)
109+
110+
table_service_client = TableServiceClient(account_url="https://<my_account_name>.table.core.windows.net", credential=sas_token)
111+
```
112+
113113
#### Looking up the account URL
114114
You can find the account's table service URL using the
115115
[Azure Portal][azure_portal_account_url],

0 commit comments

Comments
 (0)