You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/key-vault/key-vault-overview-storage-keys-powershell.md
+34-3Lines changed: 34 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -188,7 +188,8 @@ The commands in this section complete the following actions:
188
188
- Set an account shared access signature definition.
189
189
- Create an account shared access signature token for Blob, File, Table, and Queue services. The token is created for resource types Service, Container, and Object. The token is created with all permissions, over https, and with the specified start and end dates.
190
190
- Set a Key Vault managed storage shared access signature definition in the vault. The definition has the template URI of the shared access signature token that was created. The definition has the shared access signature type `account` and is valid for N days.
191
-
191
+
- Verify that the shared access signature was saved in your key vault as a secret.
192
+
-
192
193
### Set variables
193
194
194
195
First, set the variables to be used by the PowerShell cmdlets in the following steps. Be sure to update the <YourStorageAccountName> and <YourKeyVaultName> placeholders.
@@ -222,10 +223,40 @@ The value of $sasToken will look similar to this.
222
223
223
224
Use the the Azure PowerShell [Set-AzKeyVaultManagedStorageSasDefinition](/powershell/module/az.keyvault/set-azkeyvaultmanagedstoragesasdefinition?view=azps-2.6.0) cmdlet to create a shared access signature definition. You can provide the name of your choice to the `-Name` parameter.
You can verify that the shared access signature definition has been stored in your key vault using the Azure PowerShell [Get-AzKeyVaultSecret](/powershell/module/az.keyvault/get-azkeyvaultsecret?view=azps-2.6.0) cmdlet.
233
+
234
+
First, find the shared access signature definition in your key vault.
The secret corresponding to your SAS definition will have these properties:
241
+
242
+
```console
243
+
Vault Name : <YourKeyVaultName>
244
+
Name : <SecretName>
245
+
...
246
+
Content Type : application/vnd.ms-sastoken-storage
247
+
Tags :
227
248
```
228
249
250
+
You can now use the [Get-AzKeyVaultSecret](/cli/azure/keyvault/secret?view=azure-cli-latest#az-keyvault-secret-show) cmdlet and the secret `Name` property to view the content of that secret.
Copy file name to clipboardExpand all lines: articles/key-vault/key-vault-ovw-storage-keys.md
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,6 +94,7 @@ The commands in this section complete the following actions:
94
94
- Set an account shared access signature definition `<YourSASDefinitionName>`. The definition is set on a Key Vault managed storage account `<YourStorageAccountName>` in your key vault `<YourKeyVaultName>`.
95
95
- Create an account shared access signature token for Blob, File, Table, and Queue services. The token is created for resource types Service, Container, and Object. The token is created with all permissions, over https, and with the specified start and end dates.
96
96
- Set a Key Vault managed storage shared access signature definition in the vault. The definition has the template URI of the shared access signature token that was created. The definition has the shared access signature type `account` and is valid for N days.
97
+
- Verify that the shared access signature was saved in your key vault as a secret.
97
98
98
99
### Create a shared access signature token
99
100
@@ -119,6 +120,32 @@ Use the the Azure CLI [az keyvault storage sas-definition create](/cli/azure/key
You can verify that the shared access signature definition has been stored in your key vault using the Azure CLI [az keyvault secret list](/cli/azure/keyvault/secret?view=azure-cli-latest#az-keyvault-secret-list) and [az keyvault secret show](/cli/azure/keyvault/secret?view=azure-cli-latest#az-keyvault-secret-show) commands.
126
+
127
+
First, find the shared access signature definition in your key vault using the [az keyvault secret list](/cli/azure/keyvault/secret?view=azure-cli-latest#az-keyvault-secret-list) command.
128
+
129
+
```azurecli-interactive
130
+
az keyvault secret list --vault-name <YourKeyVaultName>
131
+
```
132
+
133
+
The secret corresponding to your SAS definition will have these properties:
You can now use the [az keyvault secret show](/cli/azure/keyvault/secret?view=azure-cli-latest#az-keyvault-secret-show) command and the `id` property to view the content of that secret.
141
+
142
+
```azurecli-interactive
143
+
az keyvault secret show --vault-name <YourKeyVaultName> --id <SasDefinitionID>
144
+
```
145
+
146
+
The output of this command will show your SAS definition string as`value`.
147
+
148
+
122
149
## Next steps
123
150
124
151
- Learn more about [keys, secrets, and certificates](https://docs.microsoft.com/rest/api/keyvault/).
Copy file name to clipboardExpand all lines: articles/key-vault/storage-keys-sas-tokens-code.md
+6-14Lines changed: 6 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,24 +12,16 @@ ms.date: 09/10/2019
12
12
---
13
13
# Fetch shared access signature tokens in code
14
14
15
-
Execute operations on your storage account by fetching[shared access signature tokens](../storage/common/storage-dotnet-shared-access-signature-part-1.md)from Key Vault.
15
+
You can manage your storage account with the[shared access signature tokens](../storage/common/storage-dotnet-shared-access-signature-part-1.md)in your key vault. This article provides examples of C# code that fetches a SAS token and performs operations with it. For information on how to create and store SAS tokens, see [Manage storage account keys with Key Vault and the Azure CLI](key-vault-ovw-storage-keys) or [Manage storage account keys with Key Vault and Azure PowerShell](key-vault-overview-storage-keys-powershell.md).
16
16
17
-
There are three ways to authenticate to Key Vault:
18
-
19
-
- Use a managed service identity. This approach is highly recommended.
20
-
- Use a service principal and certificate.
21
-
- Use a service principal and password. This approach isn't recommended.
22
-
23
-
For more information, see [Azure Key Vault: Basic concepts](basic-concepts.md).
24
-
25
-
The following example demonstrates how to fetch shared access signature tokens. You fetch the tokens after you create a shared access signature definition.
17
+
In this example, the code fetches a SAS token from your key vault, uses it to create a new storage account, and creates a new Blob service client.
26
18
27
19
```cs
28
20
// After you get a security token, create KeyVaultClient with vault credentials.
- Learn how to [Manage storage account keys with Key Vault and the Azure CLI](key-vault-ovw-storage-keys) or [Azure PowerShell](key-vault-overview-storage-keys-powershell.md).
0 commit comments