Extensions.Azure.WebJobs.SQS
1.0.0
dotnet add package Extensions.Azure.WebJobs.SQS --version 1.0.0
NuGet\Install-Package Extensions.Azure.WebJobs.SQS -Version 1.0.0
<PackageReference Include="Extensions.Azure.WebJobs.SQS" Version="1.0.0" />
<PackageVersion Include="Extensions.Azure.WebJobs.SQS" Version="1.0.0" />
<PackageReference Include="Extensions.Azure.WebJobs.SQS" />
paket add Extensions.Azure.WebJobs.SQS --version 1.0.0
#r "nuget: Extensions.Azure.WebJobs.SQS, 1.0.0"
#:package Extensions.Azure.WebJobs.SQS@1.0.0
#addin nuget:?package=Extensions.Azure.WebJobs.SQS&version=1.0.0
#tool nuget:?package=Extensions.Azure.WebJobs.SQS&version=1.0.0
Azure WebJobs SQS Extension
Amazon SQS extension for Azure Functions using the In-Process (WebJobs) hosting model.
đĻ Note: This package is a modernized continuation of the legacy AzureFunctions.Extension.SQS package, updated for Azure Functions v4, .NET 6/8, and modern AWS SDK patterns.
âšī¸ Recommendation: For new projects, consider using Extensions.Azure.Functions.Worker.SQS which supports the isolated worker model (Microsoft's recommended approach). The in-process model will be retired on November 10, 2026.
Installation
dotnet add package Extensions.Azure.WebJobs.SQS
Features
- â Trigger functions from Amazon SQS queues
- â Send messages to SQS queues via output bindings
- â AWS credential chain support (no hardcoded credentials needed)
- â Automatic message deletion on successful processing
- â Configurable polling intervals and visibility timeouts
- â Async/await support throughout
- â .NET 6+ and .NET 8+ support
Quick Start
Prerequisites
- Azure Functions Runtime v4
- .NET 6 or .NET 8
- AWS Account with SQS queue
- AWS credentials configured (environment variables, IAM role, or AWS CLI)
Trigger Example
using Amazon.SQS.Model;
using Azure.WebJobs.Extensions.SQS;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
public class SqsFunctions
{
[FunctionName("ProcessSqsMessage")]
public void ProcessMessage(
[SqsQueueTrigger(QueueUrl = "%SQS_QUEUE_URL%")] Message message,
ILogger log)
{
log.LogInformation("Processing message: {MessageId}", message.MessageId);
log.LogInformation("Message body: {Body}", message.Body);
// Your processing logic here
// Message is automatically deleted on success
}
}
Output Binding Example
â ī¸ Security Note: This example uses
AuthorizationLevel.Anonymousfor demonstration purposes only. In production, useAuthorizationLevel.Functionor higher and require API keys or authentication to prevent unauthorized access.
using Amazon.SQS.Model;
using Azure.WebJobs.Extensions.SQS;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
public class SqsOutputFunctions
{
[FunctionName("SendMessage")]
public async Task<IActionResult> SendMessage(
[HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest req,
[SqsQueueOut(QueueUrl = "%SQS_OUTPUT_QUEUE_URL%")] IAsyncCollector<string> messages)
{
var message = await new StreamReader(req.Body).ReadToEndAsync();
await messages.AddAsync(message);
return new OkObjectResult(new { status = "Message sent" });
}
}
Configuration
AWS Credentials
The extension uses the AWS credential chain to automatically discover credentials.
For local development - Use local.settings.json:
{
"Values": {
"AWS_ACCESS_KEY_ID": "your-access-key",
"AWS_SECRET_ACCESS_KEY": "your-secret-key",
"AWS_REGION": "us-east-1"
}
}
For Azure Functions (production) - Configure Application Settings:
- Via Azure Portal: Settings â Configuration â Application settings
- Via Azure CLI:
az functionapp config appsettings set \ --name <function-app-name> \ --resource-group <resource-group> \ --settings AWS_ACCESS_KEY_ID=<key> AWS_SECRET_ACCESS_KEY=<secret>
Best Practice - Use Azure Key Vault for production:
AWS_ACCESS_KEY_ID=@Microsoft.KeyVault(SecretUri=https://vault.azure.net/secrets/AwsAccessKeyId/)
AWS_SECRET_ACCESS_KEY=@Microsoft.KeyVault(SecretUri=https://vault.azure.net/secrets/AwsSecretAccessKey/)
The credential chain order:
- Environment variables (recommended)
- IAM roles (when running in AWS)
- AWS CLI credentials file (
~/.aws/credentials)
local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"FUNCTIONS_INPROC_NET8_ENABLED": "1",
"SQS_QUEUE_URL": "https://sqs.us-east-1.amazonaws.com/123456789012/my-queue",
"SQS_OUTPUT_QUEUE_URL": "https://sqs.us-east-1.amazonaws.com/123456789012/my-output-queue",
"AWS_REGION": "us-east-1"
}
}
Attributes
SqsQueueTriggerAttribute
Triggers a function when messages are available in an SQS queue.
| Property | Type | Description | Default |
|---|---|---|---|
QueueUrl |
string | SQS queue URL (required) | - |
AWSKeyId |
string | AWS Access Key ID (optional) | null |
AWSAccessKey |
string | AWS Secret Access Key (optional) | null |
Region |
string | AWS Region (optional) | null |
MaxNumberOfMessages |
int | Max messages per batch (1-10) | 10 |
WaitTimeSeconds |
int | Long polling wait time (0-20) | 20 |
VisibilityTimeout |
int | Message visibility timeout (seconds) | 30 |
AutoDelete |
bool | Auto-delete on success | true |
SqsQueueOutAttribute
Sends messages to an SQS queue.
| Property | Type | Description | Default |
|---|---|---|---|
QueueUrl |
string | SQS queue URL (required) | - |
AWSKeyId |
string | AWS Access Key ID (optional) | null |
AWSAccessKey |
string | AWS Secret Access Key (optional) | null |
Region |
string | AWS Region (optional) | null |
Advanced Usage
Binding to Message Object
[FunctionName("ProcessFullMessage")]
public void ProcessFullMessage(
[SqsQueueTrigger(QueueUrl = "%SQS_QUEUE_URL%")] Message message,
ILogger log)
{
log.LogInformation("Message ID: {Id}", message.MessageId);
log.LogInformation("Receipt Handle: {Handle}", message.ReceiptHandle);
log.LogInformation("Attributes: {Count}", message.Attributes.Count);
foreach (var attr in message.MessageAttributes)
{
log.LogInformation("Attribute {Key}: {Value}",
attr.Key, attr.Value.StringValue);
}
}
Sending Multiple Messages
[FunctionName("SendBatch")]
public async Task<IActionResult> SendBatch(
[HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest req,
[SqsQueueOut(QueueUrl = "%SQS_OUTPUT_QUEUE_URL%")] IAsyncCollector<string> messages)
{
for (int i = 0; i < 10; i++)
{
await messages.AddAsync($"Message {i + 1}");
}
return new OkObjectResult(new { sent = 10 });
}
Sending with Message Attributes
[FunctionName("SendWithAttributes")]
public async Task<IActionResult> SendWithAttributes(
[HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest req,
[SqsQueueOut(QueueUrl = "%SQS_OUTPUT_QUEUE_URL%")] IAsyncCollector<SendMessageRequest> messages)
{
var request = new SendMessageRequest
{
MessageBody = "Hello with attributes",
DelaySeconds = 5,
MessageAttributes = new Dictionary<string, MessageAttributeValue>
{
["Priority"] = new MessageAttributeValue
{
DataType = "Number",
StringValue = "1"
},
["Source"] = new MessageAttributeValue
{
DataType = "String",
StringValue = "AzureFunctions"
}
}
};
await messages.AddAsync(request);
return new OkObjectResult(new { status = "sent" });
}
Migration Guide
From AzureFunctions.Extension.SQS (v2.x)
This package is the direct replacement for the deprecated AzureFunctions.Extension.SQS for in-process functions.
No code changes needed! Just update your package reference:
<PackageReference Include="AzureFunctions.Extension.SQS" Version="2.0.0" />
<PackageReference Include="Azure.WebJobs.Extensions.SQS" Version="1.0.0" />
Update using statements if needed:
// Old
using Azure.Functions.Extensions.SQS;
// New
using Azure.WebJobs.Extensions.SQS;
To Isolated Worker Model
If you want to migrate to the recommended isolated worker model, use Azure.Functions.Worker.Extensions.SQS instead. See the migration guide.
Troubleshooting
Messages Not Being Processed
- Check AWS credentials are configured correctly
- Verify queue URL is correct in configuration
- Check IAM permissions for SQS actions (
sqs:ReceiveMessage,sqs:DeleteMessage) - Review Azure Functions logs for errors
Permission Issues
Ensure your AWS credentials have these permissions:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"sqs:ReceiveMessage",
"sqs:DeleteMessage",
"sqs:GetQueueAttributes",
"sqs:SendMessage"
],
"Resource": "arn:aws:sqs:*:*:*"
}
]
}
Links
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- AWSSDK.SQS (>= 3.7.0)
- Microsoft.Azure.WebJobs (>= 3.0.41)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
-
net8.0
- AWSSDK.SQS (>= 3.7.0)
- Microsoft.Azure.WebJobs (>= 3.0.41)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 659 | 12/2/2025 |
| 0.0.3-beta | 646 | 12/2/2025 |
| 0.0.2-beta | 649 | 12/2/2025 |