Nagendrra C, I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this!
Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer. Accepted answers show up at the top, resulting in improved discoverability for others.
Issue: Customer unable to set "Message never expires" expiry for queue message in Storage Queue using PowerShell.
Error Message:
Cannot find an overload for "AddMessageAsync" and the argument count: "2".
At line:1 char:1
+ $queue.CloudQueue.AddMessageAsync($queueMessage, -1)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
Solution: Customer has found the following PowerShell script useful for setting the expiry time of a queue message for an extended duration.
# Getting queue reference
$queue = New-AzStorageQueue -Name "queuename" -Context "StorageAccountContext"
#Creating Queue message
$Message = "Message here"
$queueMessage =[Microsoft.Azure.Storage.Queue.CloudQueueMessage]::new($Message)
$newTimeSpan = [TimeSpan]::new(5110.01,0,0)
$queue.CloudQueue.AddMessage($queueMessage, $newTimeSpan)