กิจกรรม
17 มี.ค. 21 - 21 มี.ค. 10
แอปอัจฉริยะ เข้าร่วมชุด meetup เพื่อสร้างโซลูชัน AI ที่ปรับขนาดได้ตามกรณีการใช้งานจริงกับนักพัฒนาและผู้เชี่ยวชาญร่วมกัน
ลงทะเบียนตอนนี้เบราว์เซอร์นี้ไม่ได้รับการสนับสนุนอีกต่อไป
อัปเกรดเป็น Microsoft Edge เพื่อใช้ประโยชน์จากคุณลักษณะล่าสุด เช่น การอัปเดตความปลอดภัยและการสนับสนุนด้านเทคนิค
In this article, you learn how to create user delegation, shared access signature (SAS) tokens, using the Azure portal or Azure Storage Explorer. User delegation SAS tokens are secured with Microsoft Entra credentials. SAS tokens provide secure, delegated access to resources in your Azure storage account.
เคล็ดลับ
Managed identities provide an alternate method for you to grant access to your storage data without the need to include SAS tokens with your HTTP requests. See, Managed identities for Document Translation.
At a high level, here's how SAS tokens work:
An application submits the SAS token to Azure Storage as part of a REST API request.
The storage service verifies that the SAS is valid. If so, the request is authorized.
The request is declined If the SAS token is deemed invalid. If so, error code 403 (Forbidden) is returned.
Azure Blob Storage offers three resource types:
ข้อสำคัญ
SAS tokens are used to grant permissions to storage resources, and should be protected in the same manner as an account key.
Operations that use SAS tokens should be performed only over an HTTPS connection, and SAS URLs should only be distributed on a secure connection such as HTTPS.
To get started, you need the following resources:
An active Azure account. If you don't have one, you can create a free account.
A Translator resource.
A standard performance Azure Blob Storage account. You also need to create containers to store and organize your files within your storage account. If you don't know how to create an Azure storage account with a storage container, follow these quickstarts:
Go to the Azure portal and navigate to your container or a specific file as follows and continue with these steps:
Create SAS token for a container | Create SAS token for a specific file |
---|---|
Your storage account → containers → your container | Your storage account → containers → your container→ your file |
Right-click the container or file and select Generate SAS from the drop-down menu.
Select Signing method → User delegation key.
Define Permissions by checking and/or clearing the appropriate check box:
Your source container or file must designate read and list access.
Your target container or file must designate write and list access.
Specify the signed key Start and Expiry times.
The Allowed IP addresses field is optional and specifies an IP address or a range of IP addresses from which to accept requests. If the request IP address doesn't match the IP address or address range specified on the SAS token, authorization fails. The IP address or a range of IP addresses must be public IPs, not private. For more information, see, Specify an IP address or IP range.
The Allowed protocols field is optional and specifies the protocol permitted for a request made with the SAS. The default value is HTTPS.
Review then select Generate SAS token and URL.
The Blob SAS token query string and Blob SAS URL are displayed in the lower area of window.
Copy and paste the Blob SAS token and URL values in a secure location. They'll only be displayed once and cannot be retrieved once the window is closed.
To construct a SAS URL, append the SAS token (URI) to the URL for a storage service.
Azure Storage Explorer is a free standalone app that enables you to easily manage your Azure cloud storage resources from your desktop.
You need the Azure Storage Explorer app installed in your Windows, macOS, or Linux development environment.
After the Azure Storage Explorer app is installed, connect it to the storage account you're using for Document Translation. Follow these steps to create tokens for a storage container or specific blob file:
Open the Azure Storage Explorer app on your local machine and navigate to your connected Storage Accounts.
Expand the Storage Accounts node and select Blob Containers.
Expand the Blob Containers node and right-click a storage container node to display the options menu.
Select Get Shared Access Signature... from options menu.
In the Shared Access Signature window, make the following selections:
A new window appears with the Container name, URI, and Query string for your container.
Copy and paste the container, URI, and query string values in a secure location. They'll only be displayed once and can't be retrieved once the window is closed.
To construct a SAS URL, append the SAS token (URI) to the URL for a storage service.
The SAS URL includes a special set of query parameters. Those parameters indicate how the client accesses the resources.
You can include your SAS URL with REST API requests in two ways:
Use the SAS URL as your sourceURL and targetURL values.
Append the SAS query string to your existing sourceURL and targetURL values.
Here's a sample REST API request:
{
"inputs": [
{
"storageType": "File",
"source": {
"sourceUrl": "https://my.blob.core.windows.net/source-en/source-english.docx?sv=2019-12-12&st=2021-01-26T18%3A30%3A20Z&se=2021-02-05T18%3A30%3A00Z&sr=c&sp=rl&sig=d7PZKyQsIeE6xb%2B1M4Yb56I%2FEEKoNIF65D%2Fs0IFsYcE%3D"
},
"targets": [
{
"targetUrl": "https://my.blob.core.windows.net/target/try/Target-Spanish.docx?sv=2019-12-12&st=2021-01-26T18%3A31%3A11Z&se=2021-02-05T18%3A31%3A00Z&sr=c&sp=wl&sig=AgddSzXLXwHKpGHr7wALt2DGQJHCzNFF%2F3L94JHAWZM%3D",
"language": "es"
},
{
"targetUrl": "https://my.blob.core.windows.net/target/try/Target-German.docx?sv=2019-12-12&st=2021-01-26T18%3A31%3A11Z&se=2021-02-05T18%3A31%3A00Z&sr=c&sp=wl&sig=AgddSzXLXwHKpGHr7wALt2DGQJHCzNFF%2F3L94JHAWZM%3D",
"language": "de"
}
]
}
]
}
That's it! You just learned how to create SAS tokens to authorize how clients access your data.
กิจกรรม
17 มี.ค. 21 - 21 มี.ค. 10
แอปอัจฉริยะ เข้าร่วมชุด meetup เพื่อสร้างโซลูชัน AI ที่ปรับขนาดได้ตามกรณีการใช้งานจริงกับนักพัฒนาและผู้เชี่ยวชาญร่วมกัน
ลงทะเบียนตอนนี้การฝึกอบรม
ใบรับรอง
รับรองโดย Microsoft: การเชื่อมโยงผู้ดูแลระบบข้อมูลประจําตัวและการเข้าถึง - Certifications
แสดงให้เห็นถึงคุณลักษณะของ Microsoft Entra ID เพื่อปรับโซลูชันข้อมูลประจําตัวให้ทันสมัย ใช้โซลูชันแบบไฮบริด และใช้การกํากับดูแลข้อมูลประจําตัว
เอกสาร
Grant limited access to data with shared access signatures (SAS) - Azure Storage
Learn about using shared access signatures (SAS) to delegate access to Azure Storage resources, including blobs, queues, tables, and files.
Create a user delegation SAS - Azure Storage
You can secure a shared access signature token for access to a container, directory, or blob by using either Microsoft Entra credentials or an account key. A SAS secured with Microsoft Entra credentials is called a user delegation SAS, because the token used to create the SAS is requested on behalf of the user. Microsoft recommends that you use Microsoft Entra credentials when possible as a security best practice.
Create a service SAS - Azure Storage
A service shared access signature (SAS) delegates access to a resource in Azure Blob Storage, Azure Queue Storage, Azure Table Storage, or Azure Files.