Cannot publish using a generated sas token
See original GitHub issueBug description
When creating a token using the following code from the scripts.v2/migrate.js file it works when calling the direct REST API, but the token does not work for publishing the portal.
async function generateSASToken(id, key, expiresIn = 3600) {
const now = moment.utc(moment());
const expiry = now.clone().add(expiresIn, 'seconds');
const expiryString = expiry.format(`YYYY-MM-DD[T]HH:mm:ss.SSSSSSS[Z]`);
const dataToSign = `${id}\n${expiryString}`;
const signedData = crypto.createHmac('sha512', key).update(dataToSign).digest('base64');
return `SharedAccessSignature uid=${id}&ex=${expiryString}&sn=${signedData}`;
}
However the publishing works if an access token is used which is generated using the Management API blade in the Azure Portal.
Reproduction steps
- Generate a token using the code above.
- Call the publish using the generated token : POST https://<service>.developer.azure-api.net/publish HTTP/1.1 content-type: application/json Authorization: SharedAccessSignature i45983457…
- 200 is received
- Wait three minutes to make sure that the portal was not published.
Expected behavior
Expected the portal to be published.
Is your portal managed or self-hosted?
Managed
API Management service name
I’ll send you the name.
Environment
- Operating system: Windows 10
- Node : v14.16.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Can't generate Azure SAS connection string. Suspect this is ...
The following message is present "Some routing options are disabled because the endpoints are not published." The button "Generate SAS and ...
Read more >Programmatically created SAS Token not working in publish ...
Hello, During the publish step of the self hosted dev portal a SAS Token is required in the config.publish.json (described here: ...
Read more >Create a service SAS - Azure Storage | Microsoft Learn
A service shared access signature (SAS) delegates access to a resource in Azure Blob Storage, Azure Queue Storage, Azure Table Storage, ...
Read more >How to Generate an Azure SAS Token to Access Storage ...
To create a token via the Azure portal, first, navigate to the storage account you'd like to access under the Settings section then...
Read more >54863 - Long-running SAS® stored process requests might ...
If a SAS® stored process request requires more than 5 minutes to complete execution, then it might not be able to publish a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Most of public services have been upgraded, the issue should be gone.
Hi Erik, yes, there is a regression. We’re working on it.