Closed ghost closed 2 years ago
Thank you for your feedback. Tagging and routing to the team member best able to assist.
@TarekMansour , can you try adding myClient.SubscriptionId = "xxxx";
after client contruction? That should at least fix this error. Also I didn't see any assignment to productContract
's properties.
@allenjzhang Thank you! yes it works by adding myClient.SubscriptionId = "xxxx";
At the beginning I was testing the SDK that's why for productContract
's properties I just initiate the displayName
(required field)
now I'm calling that method from another service where I prepare the ProductContract
.
More than adding myClient.SubscriptionId = "xxxx";
, we need to override ProcessHttpRequestAsync
to use the authentication token as an Authorization header:
public override async Task ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
if (request == null) throw new ArgumentNullException("request");
if (AuthenticationToken == null) throw new InvalidOperationException("Token Provider Cannot Be Null");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", AuthenticationToken);
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
await base.ProcessHttpRequestAsync(request, cancellationToken);
}
At the end I want to add a feedback to say even it works like we discussed the documentation still not clear as we are used to have in the official Microsoft documentation.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @miaojiang.
Author: | TarekMansour |
---|---|
Assignees: | markcowl |
Labels: | `API Management`, `Mgmt`, `Service Attention`, `customer-reported`, `needs-team-attention`, `question` |
Milestone: | - |
Hi @ghost. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve
” to remove the “issue-addressed” label and continue the conversation.
Hi @ghost, since you haven’t asked that we “/unresolve
” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve
” to reopen the issue.
Question How to create new Products for Azure API management instance using
Microsoft.Azure.Management.ApiManagement
?Environment:
Microsoft.Azure.Management.ApiManagement 6.0.0-preview
Runtime Environment: OS Name: Windows OS Version: 10.0.18363 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.1.402\
Host (useful for support): Version: 3.1.8 Commit: 9c1330dedd
.NET Core SDKs installed: 2.2.110 [C:\Program Files\dotnet\sdk] 2.2.207 [C:\Program Files\dotnet\sdk] 3.1.101 [C:\Program Files\dotnet\sdk] 3.1.401 [C:\Program Files\dotnet\sdk] 3.1.402 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
So I'm trying to create new Product into my APIM instance but I got this error:
Microsoft.Rest.ValidationException: 'this.Client.SubscriptionId' cannot be null.
What I understand is to assign my subscription with the client I use but I don't know if I'm right or not and how to do it
Can you please challenge me with your ideas?
thank you! 😊