b8ba6c4548
Bumps the kiota-dependencies group in /sample-api/clients/dotnet/src with 6 updates: | Package | From | To | | --- | --- | --- | | [Microsoft.Kiota.Abstractions](https://github.com/microsoft/kiota-dotnet) | `1.12.3` | `1.12.4` | | [Microsoft.Kiota.Authentication.Azure](https://github.com/microsoft/kiota-dotnet) | `1.12.3` | `1.12.4` | | [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-dotnet) | `1.12.3` | `1.12.4` | | [Microsoft.Kiota.Serialization.Form](https://github.com/microsoft/kiota-dotnet) | `1.12.3` | `1.12.4` | | [Microsoft.Kiota.Serialization.Json](https://github.com/microsoft/kiota-dotnet) | `1.12.3` | `1.12.4` | | [Microsoft.Kiota.Serialization.Text](https://github.com/microsoft/kiota-dotnet) | `1.12.3` | `1.12.4` | Updates `Microsoft.Kiota.Abstractions` from 1.12.3 to 1.12.4 - [Release notes](https://github.com/microsoft/kiota-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-dotnet/compare/v1.12.3...v1.12.4) Updates `Microsoft.Kiota.Authentication.Azure` from 1.12.3 to 1.12.4 - [Release notes](https://github.com/microsoft/kiota-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-dotnet/compare/v1.12.3...v1.12.4) Updates `Microsoft.Kiota.Abstractions` from 1.12.3 to 1.12.4 - [Release notes](https://github.com/microsoft/kiota-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-dotnet/compare/v1.12.3...v1.12.4) Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.12.3 to 1.12.4 - [Release notes](https://github.com/microsoft/kiota-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-dotnet/compare/v1.12.3...v1.12.4) Updates `Microsoft.Kiota.Abstractions` from 1.12.3 to 1.12.4 - [Release notes](https://github.com/microsoft/kiota-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-dotnet/compare/v1.12.3...v1.12.4) Updates `Microsoft.Kiota.Serialization.Form` from 1.12.3 to 1.12.4 - [Release notes](https://github.com/microsoft/kiota-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-dotnet/compare/v1.12.3...v1.12.4) Updates `Microsoft.Kiota.Abstractions` from 1.12.3 to 1.12.4 - [Release notes](https://github.com/microsoft/kiota-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-dotnet/compare/v1.12.3...v1.12.4) Updates `Microsoft.Kiota.Serialization.Json` from 1.12.3 to 1.12.4 - [Release notes](https://github.com/microsoft/kiota-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-dotnet/compare/v1.12.3...v1.12.4) Updates `Microsoft.Kiota.Abstractions` from 1.12.3 to 1.12.4 - [Release notes](https://github.com/microsoft/kiota-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-dotnet/compare/v1.12.3...v1.12.4) Updates `Microsoft.Kiota.Serialization.Text` from 1.12.3 to 1.12.4 - [Release notes](https://github.com/microsoft/kiota-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-dotnet/compare/v1.12.3...v1.12.4) Updates `Microsoft.Kiota.Abstractions` from 1.12.3 to 1.12.4 - [Release notes](https://github.com/microsoft/kiota-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-dotnet/compare/v1.12.3...v1.12.4) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Authentication.Azure dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Form dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Text dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] <support@github.com> |
||
---|---|---|
.. | ||
.vscode | ||
src | ||
.gitattributes | ||
.gitignore | ||
README.md | ||
RegisterApp.ps1 | ||
makesdk.bat |
README.md
ToDoItem Sample API .NET Kiota Client
This sample implements a client for the ToDoItem sample API. It includes an SDK generated by Kiota in the Client folder.
The SDK was generated using the command in makesdk.bat. You can use the makesdk.bat file or the command to regenerate the SDK.
kiota -c ToDoApiClient -n ToDoClient.ApiClient -d https://localhost:7206/openapi/openapi.yaml -o ./src/Client
Prerequisites
-
.NET SDK version 7+
-
An Azure account with an active subscription. Create an Azure account for free or join the Microsoft 365 Developer Program to get a free instant sandbox for testing.
-
The Azure account must have permission to manage applications in Azure Active Directory (Azure AD). Any of the following Azure AD roles include the required permissions:
- Application administrator
- Application developer
- Cloud application administrator
- Global administrator
-
The ToDoItem sample API running on your local machine.
Configure the sample
The sample API uses Azure AD to protect the Web API. In order to authenticate and get access tokens to access the API, you'll need to register an application in Azure AD for this sample client and add the app registration to the sample. You can install the Microsoft Graph PowerShell SDK and use the included PowerShell script to automate the process, or register the app manually.
Use PowerShell
Note: The PowerShell script requires an account with the Application administrator, Cloud application administrator, or Global administrator role. If your account has the Application developer role, you can register manually.
Open PowerShell in the root of this project and run the following command.
.\RegisterApp.ps1
This will open a browser window to the Microsoft identity platform's sign-in page. Sign in with your Azure account, review the requested permissions, and consent to the application. This creates an app registration named Kiota ToDoItem Sample API .NET Client
and save the needed configuration in ./src/appsettings.local.json
.
The script also accepts optional parameters to change how it behaves.
-AppName <string>
: Set the name of the app registration-TenantId <string>
: Specify the tenant ID of the Azure subscription to create the app registration in.-StayConnected
: The script will leave the Microsoft Graph PowerShell SDK's session open rather than disconnect when it is finished.
Register manually
-
Open a browser and navigate to the Azure Active Directory admin center. Login with your Azure account.
-
Select Azure Active Directory in the left-hand navigation, then select App registrations under Manage.
-
Select New registration. On the Register an application page, set the values as follows.
- Set Name to
Kiota ToDoItem Sample API .NET Client
. - Set Supported account types to Accounts in this organizational directory only.
- Leave Redirect URI blank.
- Set Name to
-
Select Register. On the Kiota ToDoItem Sample API .NET Client page, copy the values of the Application (client) ID and Directory (tenant) ID and save them, you will need to add them to the sample once you are done configuring the app registration.
-
Select Authentication under Manage.
-
Locate the Advanced settings section. Set the Allow public client flows toggle to Yes, then select Save.
-
Create a new file in the ./src directory named appsettings.local.json and add the following contents. Replace
YOUR_CLIENT_ID
with the client ID from your app registration, and replaceYOUR_TENANT_ID
with your tenant ID.{ "Settings": { "ClientId": "YOUR_CLIENT_ID", "TenantId": "YOUR_TENANT_ID", "ApiScope": "api://YOUR_TODO_API_CLIENT_ID/ToDoItem.ReadWrite" } }
Run the sample
Before running the sample client, make sure that you have the sample API project running on your local machine.
Start the sample with the dotnet run
command in the ./src directory. Alternatively, you can open this project folder with Visual Studio Code or open ToDoClient.csproj with Visual Studio and debug the code by pressing F5.
The application prompts for authenticate in a browser.
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code F8HNE7ABP to authenticate.