I try to create a subscription in Azure APIM with:
New-AzApiManagementSubscription -Context $Context -Name "test-01" -Scope "/products/test-ericf" -Verbose
but always receive error message:
New-AzApiManagementSubscription:
Error Code: ValidationError
Error Message: One or more fields contain incorrect values:
Request Id: 7fc113c3-83af-4c6d-9e50-6825aefb3817
Error Details:
[Code= ValidationError, Message= Invalid field 'ownerId' specified, Target= ownerId]
Any ideas?
I also tried with -debug
, and got the error:
New-AzApiManagementSubscription:
Error Code: ValidationError
Error Message: One or more fields contain incorrect values:
Request Id: c6a6e092-66ac-4886-9569-d9a6c8e7cb17
Error Details:
[Code= ValidationError, Message= Invalid field 'ownerId' specified, Target=
2
Answers
Invalid owner id occurs when you want to associate a subscription to the specific user under APIM. To avoid this kind of issues, retrieve the assigned users from APIM in the below format first.
Take the respective
userId
from it and assign the subscription to the user as shown below.Alternatively, I have also tried with the default starter product without any user related information, and it worked as expected.
Reference: MSDoc
Thanks a lot
I will try that .
Which version of PS do you use ?
I use powershell 7.4
Regards