Azure function API just returning 256 records

87 Views Asked by At

I have created Azure Function Api and this API returning random passwords. I am executing loop 4000 times and calling this API but this API just returning 256 random password and remaining as null...

I have executed same API code locally and it is working fine without function API so look like there is some limitation with Azure Functions.

Can someone please suggest if they encounter same issue or how can scale this up to get 4000+ records?

Please suggest...

This is what i have in my API

public static class HashPwd
{
    [FunctionName("HashPwd")]
    public static async Task<IActionResult> Run(
        [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req,
        ILogger log)
    {
        log.LogInformation("C# HTTP trigger function processed a request.");

        string name = req.Query["name"];

        string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
        dynamic data = JsonConvert.DeserializeObject(requestBody);
        name = RandomPassword(name); 

        string responseMessage = string.IsNullOrEmpty(name)
            ? "TempPassword"
            : $"{name}";

        return new OkObjectResult(responseMessage);
    }

    private static string RandomPassword(string name)
    {
        int lengthOfPassword = 8;
        string encyPassword = "";
        string valid = "abcdefghijklmnozABCDEFGHIJKLMNOZ1234567890!@#$%&";
        StringBuilder orgPasswordR = new StringBuilder();
        Random random = new Random();
        while (0 < lengthOfPassword--)
        {
            orgPasswordR.Append(valid[random.Next(valid.Length)]);
        }
        string orgPassword = orgPasswordR.ToString();
        return orgPassword;

    }
1

There are 1 best solutions below

0
unknown On

I find limits about Azure Function in this doc. enter image description here

Please check your configurations(e.g. web.config) and set them up to a bigger number. Hope it helps.