Hi Adnan Mohsin
Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.
The error message specifies supported API versions such as 2024-11-01 and 2024-08-01. Please update your script to use one of these supported versions.
$apiVersion = '2024-11-01'
https://learn.microsoft.com/en-us/rest/api/searchservice/search-service-api-versions#2024-11-01-preview
The error message also mentions that the ResourceId parameter is empty. verify that you're passing a valid, non-empty ResourceId in your script. This could be a key point in resolving the issue.
Please verify that your script is properly authenticated and that you have the necessary permissions to access the resources you're working with in Azure.
To further isolate the issue, you can create a simplified version of your script to test basic operations using the intended API version. This can help confirm whether the issue is with the API version or another aspect of your script.
It's important to verify that you have the latest Az PowerShell module installed. You can update it using the following command:
Update-Module -Name Az
Reference:
https://learn.microsoft.com/en-us/rest/api/?view=Azure&term=update%20manager
If you have any further queries, do let us know.
If the answer is helpful, please and "Upvote it".