How to use context and login information in autorest generated code? #23233
-
ITNOA Hi, I want to write PowerShell CLI for my system based on my REST Api service, and for doing this I want to use autorest.powershell tools to automate generating cmdlet for me, one important thing for me is that my system has authentication and authorization for REST API, so if I want to call REST API in cmdlet, I need to login into system before that and send JWT for each calling for API. I see the Azure PowerShell has same requirement, and I see the Azure PowerShell has For learning this I read some of Azure PowerShell modules, such as So my question in this example is How My project is remote IpTables and open source and in GitHub |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
related to Azure/autorest.powershell#1252 related to BSVN/IpTables.Api#34 |
Beta Was this translation helpful? Give feedback.
-
@YanaXu @msJinLei Did you can any help me? thanks |
Beta Was this translation helpful? Give feedback.
-
To put it simply, we acquire JWT token from Microsoft Entra ID server using MSAL.net, and put it as part of header of the request to manipulate the Azure resources. See https://learn.microsoft.com/en-us/machine-learning-server/operationalize/how-to-manage-access-tokens#use-tokens If you are using autorest.powershell, the authentication process is handled in generated codes. But you need a swagger spec to generate the codes. Do you have a swagger? |
Beta Was this translation helpful? Give feedback.
-
Following is a solution I could think of.
|
Beta Was this translation helpful? Give feedback.
Following is a solution I could think of.