Skip to content

Commit e292362

Browse files
authored
[Governance] Fixing outdated references (Azure#48586)
* [Governance] Fixing outdated references The focus of these changes is to update the package references in the TimeSeriesInsights client sample to remove deprecated/vulnerable packages. Also included is a bump to the Event Hubs sample target frameworks to modernize. * Adding <IsTestProject> to stop pullrequest from looking for a changelog * Removing auto-generated solution * Updating README content to bypass weird changelog logic * Explicitly overriding <IsShippingLibrary> * Moving non-shipping declaration to props
1 parent 7d6137d commit e292362

File tree

8 files changed

+61
-82
lines changed

8 files changed

+61
-82
lines changed

sdk/eventhub/Azure.Messaging.EventHubs.Processor/samples/aspnet-hosted-service/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313

1414
<PropertyGroup>
1515
<IsShippingLibrary>false</IsShippingLibrary>
16-
<RequiredTargetFrameworks Condition="$(IsTestProject) != 'true'">net6.0;net7.0</RequiredTargetFrameworks>
16+
<RequiredTargetFrameworks Condition="$(IsTestProject) != 'true'">net8.0;net9.0</RequiredTargetFrameworks>
1717
</PropertyGroup>
1818
</Project>

sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/Azure.IoT.TimeSeriesInsights.sln

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.29709.97
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.13.35825.156
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.IoT.TimeSeriesInsights", "src\Azure.IoT.TimeSeriesInsights.csproj", "{E33D09D9-D809-472C-82E6-6A26BDB86FC2}"
77
EndProject
@@ -20,7 +20,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
2020
..\Update-TsiSnippets.ps1 = ..\Update-TsiSnippets.ps1
2121
EndProjectSection
2222
EndProject
23-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TimeSeriesInsightsClientSample", "samples\TimeSeriesInsightsClientSample\TimeSeriesInsightsClientSample.csproj", "{D243481B-0944-4F60-9B1F-35EDFC7769BA}"
23+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.IoT.TimeSeriesInsights.Tests.ClientSample", "samples\TimeSeriesInsightsClientSample\Azure.IoT.TimeSeriesInsights.Tests.ClientSample.csproj", "{D243481B-0944-4F60-9B1F-35EDFC7769BA}"
2424
EndProject
2525
Global
2626
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -44,10 +44,6 @@ Global
4444
{D243481B-0944-4F60-9B1F-35EDFC7769BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
4545
{D243481B-0944-4F60-9B1F-35EDFC7769BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
4646
{D243481B-0944-4F60-9B1F-35EDFC7769BA}.Release|Any CPU.Build.0 = Release|Any CPU
47-
{7FE9FA2F-7793-4EB9-B8D0-26696536508B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
48-
{7FE9FA2F-7793-4EB9-B8D0-26696536508B}.Debug|Any CPU.Build.0 = Debug|Any CPU
49-
{7FE9FA2F-7793-4EB9-B8D0-26696536508B}.Release|Any CPU.ActiveCfg = Release|Any CPU
50-
{7FE9FA2F-7793-4EB9-B8D0-26696536508B}.Release|Any CPU.Build.0 = Release|Any CPU
5147
EndGlobalSection
5248
GlobalSection(SolutionProperties) = preSolution
5349
HideSolutionNode = FALSE
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<PropertyGroup>
3+
<ExcludeFromCodeCoverage>true</ExcludeFromCodeCoverage>
4+
<IsPackable>false</IsPackable>
5+
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
6+
</PropertyGroup>
7+
8+
<!-- Import the common SDK build properties. -->
9+
<Import
10+
Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., Directory.Build.props))\Directory.Build.props"
11+
Condition="'$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., Directory.Build.props))' != ''"
12+
/>
13+
14+
<PropertyGroup>
15+
<IsShippingLibrary>false</IsShippingLibrary>
16+
</PropertyGroup>
17+
</Project>

sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/samples/Readme.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,7 @@ A `TimeSeriesInsightsClient` is the primary interface for developers using the T
55
## Creating TimeSeriesInsightsClient
66

77
To create a new Time Series Insights client, you need the endpoint to an Azure Time Series Insights environment and supply credentials.
8-
To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below,
9-
or other credential providers provided with the Azure SDK, please install the Azure.Identity package:
10-
11-
```dotnetcli
12-
dotnet add package Azure.Identity
13-
```
14-
15-
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET.
8+
To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below, or other credential providers provided with the Azure SDK, please install the [Azure.Identity][AzureIdentity].
169

1710
```C# Snippet:TimeSeriesInsightsSampleCreateServiceClientWithClientSecret
1811
// DefaultAzureCredential supports different authentication mechanisms and determines the appropriate credential type based on the environment it is executing in.
@@ -24,7 +17,7 @@ var client = new TimeSeriesInsightsClient(
2417
tokenCredential);
2518
```
2619

27-
# Time Series Insights Samples
20+
## Time Series Insights Samples
2821

2922
The following section provides several code snippets using the `client` created above, and covers the main functions of Time Series Insights. You can explore and learn more about the Time Series Insights client library APIs through using the samples project.
3023

@@ -69,9 +62,9 @@ Here's what a retrieved model settings object looks like.
6962
{
7063
"Name": "Building",
7164
"Type": {
72-
"HasValue": true,
65+
"HasValue": true,
7366
"Value": {
74-
67+
7568
}
7669
}
7770
},
@@ -80,7 +73,7 @@ Here's what a retrieved model settings object looks like.
8073
"Type": {
8174
"HasValue": true,
8275
"Value": {
83-
76+
8477
}
8578
}
8679
},
@@ -89,7 +82,7 @@ Here's what a retrieved model settings object looks like.
8982
"Type": {
9083
"HasValue": true,
9184
"Value": {
92-
85+
9386
}
9487
}
9588
}
@@ -686,7 +679,8 @@ await foreach (TimeSeriesPoint point in query.GetResultsAsync())
686679
```
687680

688681
<!-- LINKS -->
689-
[DefaultAzureCredential]: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/identity/Azure.Identity/README.md
682+
[AzureIdentity]: https://learn.microsoft.com/dotnet/api/overview/azure/identity-readme?view=azure-dotnet
683+
[DefaultAzureCredential]: https://learn.microsoft.com/dotnet/api/azure.identity.defaultazurecredential?view=azure-dotnet
690684
[tsi_instances_learn_more]: https://learn.microsoft.com/azure/time-series-insights/concepts-model-overview#time-series-model-instances
691685
[tsi_id_learn_more]: https://learn.microsoft.com/azure/time-series-insights/how-to-select-tsid
692686
[tsi_hierarchies_learn_more]: https://learn.microsoft.com/azure/time-series-insights/concepts-model-overview#time-series-model-hierarchies
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<IsSamplesProject>true</IsSamplesProject>
7+
</PropertyGroup>
8+
9+
<!-- NU5104: Using a project reference to the client causes build warning/errors on build agents. -->
10+
<PropertyGroup>
11+
<NoWarn>$(NoWarn);AZC0100;AZC0012;CS1591</NoWarn>
12+
</PropertyGroup>
13+
14+
<ItemGroup>
15+
<PackageReference Include="Azure.Identity" />
16+
<PackageReference Include="CommandLineParser" />
17+
<PackageReference Include="Microsoft.Azure.Devices" />
18+
<PackageReference Include="Microsoft.Azure.Devices.Client" />
19+
</ItemGroup>
20+
21+
<ItemGroup>
22+
<ProjectReference Include="..\..\src\Azure.IoT.TimeSeriesInsights.csproj" />
23+
</ItemGroup>
24+
25+
<ItemGroup>
26+
<AdditionalFiles Include="..\readme.md" />
27+
</ItemGroup>
28+
29+
</Project>

sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/samples/TimeSeriesInsightsClientSample/Options.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,6 @@ public class Options
1616
[Option('a', "tsiEnvironmentFqdn", Required = true, HelpText = "Time Series Insights environment FQDN")]
1717
public string TsiEnvironmentFqdn { get; set; }
1818

19-
/// <summary>
20-
/// The application Id used to log the user in.
21-
/// </summary>
22-
[Option('i', "clientId", Required = true, HelpText = "Client Id of the application Id to login, or the application Id used to log the user in.")]
23-
public string ClientId { get; set; }
24-
25-
/// <summary>
26-
/// The tenant Id used when logging the user in.
27-
/// </summary>
28-
[Option('t', "tenantId", Required = true, HelpText = "Application tenant Id")]
29-
public string TenantId { get; set; }
30-
31-
/// <summary>
32-
/// The application client secret.
33-
/// </summary>
34-
[Option('s', "clientSecret", Required = false, HelpText = "Application client secret. Only applicable when using LoginMethod of AppId.")]
35-
public string ClientSecret { get; set; }
36-
3719
/// <summary>
3820
/// The IoT hub connection string.
3921
/// </summary>

sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/samples/TimeSeriesInsightsClientSample/Program.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ public static async Task Main(string[] args)
3434
});
3535

3636
// Instantiate the Time Series Insights client
37-
TimeSeriesInsightsClient tsiClient = GetTimeSeriesInsightsClient(
38-
options.TenantId,
39-
options.ClientId,
40-
options.ClientSecret,
41-
options.TsiEnvironmentFqdn);
37+
TimeSeriesInsightsClient tsiClient = GetTimeSeriesInsightsClient(options.TsiEnvironmentFqdn);
4238

4339
// Instantiate an IoT Hub device client client in order to send telemetry to the hub
4440
DeviceClient deviceClient = await GetDeviceClientAsync(options.IoTHubConnectionString).ConfigureAwait(false);
@@ -62,7 +58,7 @@ public static async Task Main(string[] args)
6258

6359
var tsiHierarchiesSamples = new HierarchiesSamples();
6460
await tsiHierarchiesSamples.RunSamplesAsync(tsiClient);
65-
61+
6662
var tsiModelSettingsSamples = new ModelSettingsSamples();
6763
await tsiModelSettingsSamples.RunSamplesAsync(tsiClient);
6864

@@ -75,13 +71,8 @@ public static async Task Main(string[] args)
7571
/// implementation of <see cref="Azure.Core.TokenCredential"/>.
7672
/// </summary>
7773
/// <param name="tsiEndpoint">The endpoint of the Time Series Insights instance.</param>
78-
private static TimeSeriesInsightsClient GetTimeSeriesInsightsClient(string tenantId, string clientId, string clientSecret, string tsiEndpoint)
74+
private static TimeSeriesInsightsClient GetTimeSeriesInsightsClient(string tsiEndpoint)
7975
{
80-
// These environment variables are necessary for DefaultAzureCredential to use application Id and client secret to login.
81-
Environment.SetEnvironmentVariable("AZURE_CLIENT_SECRET", clientSecret);
82-
Environment.SetEnvironmentVariable("AZURE_CLIENT_ID", clientId);
83-
Environment.SetEnvironmentVariable("AZURE_TENANT_ID", tenantId);
84-
8576
#region Snippet:TimeSeriesInsightsSampleCreateServiceClientWithClientSecret
8677

8778
// DefaultAzureCredential supports different authentication mechanisms and determines the appropriate credential type based on the environment it is executing in.

sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/samples/TimeSeriesInsightsClientSample/TimeSeriesInsightsClientSample.csproj

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)