Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function main() {
// Create Queue Service Client from Account connection string or SAS connection string
// Account connection string example - `DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net`
// SAS connection string example - `BlobEndpoint=https://myaccount.blob.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString`
const STORAGE_CONNECTION_STRING = process.env.STORAGE_CONNECTION_STRING || "";
// Note - Account connection string can only be used in node.
const queueServiceClient = QueueServiceClient.fromConnectionString(STORAGE_CONNECTION_STRING);
// Create a new queue
const queueName = `newqueue${new Date().getTime()}`;
const queueClient = queueServiceClient.getQueueClient(queueName);
const createQueueResponse = await queueClient.create();
console.log(
`Create queue ${queueName} successfully, service assigned request Id: ${createQueueResponse.requestId}`
);
// Delete the queue.
const deleteQueueResponse = await queueClient.delete();
console.log(
`Delete queue successfully, service assigned request Id: ${deleteQueueResponse.requestId}`
);
}
export async function main() {
// Create Queue Service Client from Account connection string or SAS connection string
// Account connection string example - `DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net`
// SAS connection string example - `BlobEndpoint=https://myaccount.blob.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString`
const STORAGE_CONNECTION_STRING = process.env.STORAGE_CONNECTION_STRING || "";
// Note - Account connection string can only be used in node.
const queueServiceClient = QueueServiceClient.fromConnectionString(STORAGE_CONNECTION_STRING);
// Create a new queue
const queueName = `newqueue${new Date().getTime()}`;
const queueClient = queueServiceClient.getQueueClient(queueName);
const createQueueResponse = await queueClient.create();
console.log(
`Create queue ${queueName} successfully, service assigned request Id: ${createQueueResponse.requestId}`
);
// Delete the queue.
const deleteQueueResponse = await queueClient.delete();
console.log(
`Delete queue successfully, service assigned request Id: ${deleteQueueResponse.requestId}`
);
}