Skip to content

Commit 459b6f6

Browse files
Migrate ApplicationInsights from generation to main (#20782)
* Move ApplicationInsights to main * Update ChangeLog.md --------- Co-authored-by: Yabo Hu <yabhu@microsoft.com>
1 parent 23aad2b commit 459b6f6

File tree

10 files changed

+78
-69
lines changed

10 files changed

+78
-69
lines changed

src/ApplicationInsights/ApplicationInsights.sln

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.0.31903.59
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{1625AD17-DDE6-4E3D-8124-D2326AEC2A7A}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{7E3FEA03-4F54-4AE2-B678-A3FF26CBF753}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{4DF7B7D5-CC89-4D38-AD4E-6FC0F480F068}"
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{43DCE324-743F-44AD-A380-E57208168AC3}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{8E2987C0-09B0-41DB-A1A2-7FD3F4D021C3}"
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{FF66413F-453E-425D-B003-79C16A4C2CBB}"
1111
EndProject
12-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{13D2CAE7-AD3B-475D-8B60-26CDCCDEED67}"
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{48452AD8-CFFD-4B08-8A53-C295E5721AA9}"
1313
EndProject
14-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{6D2AE481-CB85-4882-8AF7-B93B7FEC7451}"
14+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{0E79D346-6BD1-4000-95E1-AAFB2E70B8A5}"
1515
EndProject
16-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.ApplicationInsights", "Az.ApplicationInsights.csproj", "{2243E46B-2C05-4FA0-AC0B-EFD5DA24E20D}"
16+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{9A370B7D-04F3-4DA4-A81B-0CBE696E8F4A}"
17+
EndProject
18+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.ApplicationInsights", "Az.ApplicationInsights.csproj", "{371A62A3-148D-42BD-95EE-DCD05A003DF0}"
1719
EndProject
1820
Global
1921
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -24,29 +26,33 @@ Global
2426
HideSolutionNode = FALSE
2527
EndGlobalSection
2628
GlobalSection(ProjectConfigurationPlatforms) = postSolution
27-
{1625AD17-DDE6-4E3D-8124-D2326AEC2A7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
28-
{1625AD17-DDE6-4E3D-8124-D2326AEC2A7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
29-
{1625AD17-DDE6-4E3D-8124-D2326AEC2A7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
30-
{1625AD17-DDE6-4E3D-8124-D2326AEC2A7A}.Release|Any CPU.Build.0 = Release|Any CPU
31-
{4DF7B7D5-CC89-4D38-AD4E-6FC0F480F068}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
32-
{4DF7B7D5-CC89-4D38-AD4E-6FC0F480F068}.Debug|Any CPU.Build.0 = Debug|Any CPU
33-
{4DF7B7D5-CC89-4D38-AD4E-6FC0F480F068}.Release|Any CPU.ActiveCfg = Release|Any CPU
34-
{4DF7B7D5-CC89-4D38-AD4E-6FC0F480F068}.Release|Any CPU.Build.0 = Release|Any CPU
35-
{8E2987C0-09B0-41DB-A1A2-7FD3F4D021C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
36-
{8E2987C0-09B0-41DB-A1A2-7FD3F4D021C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
37-
{8E2987C0-09B0-41DB-A1A2-7FD3F4D021C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
38-
{8E2987C0-09B0-41DB-A1A2-7FD3F4D021C3}.Release|Any CPU.Build.0 = Release|Any CPU
39-
{13D2CAE7-AD3B-475D-8B60-26CDCCDEED67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
40-
{13D2CAE7-AD3B-475D-8B60-26CDCCDEED67}.Debug|Any CPU.Build.0 = Debug|Any CPU
41-
{13D2CAE7-AD3B-475D-8B60-26CDCCDEED67}.Release|Any CPU.ActiveCfg = Release|Any CPU
42-
{13D2CAE7-AD3B-475D-8B60-26CDCCDEED67}.Release|Any CPU.Build.0 = Release|Any CPU
43-
{6D2AE481-CB85-4882-8AF7-B93B7FEC7451}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
44-
{6D2AE481-CB85-4882-8AF7-B93B7FEC7451}.Debug|Any CPU.Build.0 = Debug|Any CPU
45-
{6D2AE481-CB85-4882-8AF7-B93B7FEC7451}.Release|Any CPU.ActiveCfg = Release|Any CPU
46-
{6D2AE481-CB85-4882-8AF7-B93B7FEC7451}.Release|Any CPU.Build.0 = Release|Any CPU
47-
{2243E46B-2C05-4FA0-AC0B-EFD5DA24E20D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
48-
{2243E46B-2C05-4FA0-AC0B-EFD5DA24E20D}.Debug|Any CPU.Build.0 = Debug|Any CPU
49-
{2243E46B-2C05-4FA0-AC0B-EFD5DA24E20D}.Release|Any CPU.ActiveCfg = Release|Any CPU
50-
{2243E46B-2C05-4FA0-AC0B-EFD5DA24E20D}.Release|Any CPU.Build.0 = Release|Any CPU
29+
{7E3FEA03-4F54-4AE2-B678-A3FF26CBF753}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30+
{7E3FEA03-4F54-4AE2-B678-A3FF26CBF753}.Debug|Any CPU.Build.0 = Debug|Any CPU
31+
{7E3FEA03-4F54-4AE2-B678-A3FF26CBF753}.Release|Any CPU.ActiveCfg = Release|Any CPU
32+
{7E3FEA03-4F54-4AE2-B678-A3FF26CBF753}.Release|Any CPU.Build.0 = Release|Any CPU
33+
{43DCE324-743F-44AD-A380-E57208168AC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
34+
{43DCE324-743F-44AD-A380-E57208168AC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
35+
{43DCE324-743F-44AD-A380-E57208168AC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
36+
{43DCE324-743F-44AD-A380-E57208168AC3}.Release|Any CPU.Build.0 = Release|Any CPU
37+
{FF66413F-453E-425D-B003-79C16A4C2CBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
38+
{FF66413F-453E-425D-B003-79C16A4C2CBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
39+
{FF66413F-453E-425D-B003-79C16A4C2CBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
40+
{FF66413F-453E-425D-B003-79C16A4C2CBB}.Release|Any CPU.Build.0 = Release|Any CPU
41+
{48452AD8-CFFD-4B08-8A53-C295E5721AA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
42+
{48452AD8-CFFD-4B08-8A53-C295E5721AA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
43+
{48452AD8-CFFD-4B08-8A53-C295E5721AA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
44+
{48452AD8-CFFD-4B08-8A53-C295E5721AA9}.Release|Any CPU.Build.0 = Release|Any CPU
45+
{0E79D346-6BD1-4000-95E1-AAFB2E70B8A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
46+
{0E79D346-6BD1-4000-95E1-AAFB2E70B8A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
47+
{0E79D346-6BD1-4000-95E1-AAFB2E70B8A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
48+
{0E79D346-6BD1-4000-95E1-AAFB2E70B8A5}.Release|Any CPU.Build.0 = Release|Any CPU
49+
{9A370B7D-04F3-4DA4-A81B-0CBE696E8F4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
50+
{9A370B7D-04F3-4DA4-A81B-0CBE696E8F4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
51+
{9A370B7D-04F3-4DA4-A81B-0CBE696E8F4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
52+
{9A370B7D-04F3-4DA4-A81B-0CBE696E8F4A}.Release|Any CPU.Build.0 = Release|Any CPU
53+
{371A62A3-148D-42BD-95EE-DCD05A003DF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
54+
{371A62A3-148D-42BD-95EE-DCD05A003DF0}.Debug|Any CPU.Build.0 = Debug|Any CPU
55+
{371A62A3-148D-42BD-95EE-DCD05A003DF0}.Release|Any CPU.ActiveCfg = Release|Any CPU
56+
{371A62A3-148D-42BD-95EE-DCD05A003DF0}.Release|Any CPU.Build.0 = Release|Any CPU
5157
EndGlobalSection
5258
EndGlobal

src/ApplicationInsights/Az.ApplicationInsights.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Microsoft Corporation
55
#
6-
# Generated on: 1/6/2023
6+
# Generated on: 1/30/2023
77
#
88

99
@{
@@ -141,7 +141,7 @@ PrivateData = @{
141141
# IconUri = ''
142142

143143
# ReleaseNotes of this module
144-
ReleaseNotes = '* Enabled output object enumerating for ''Get-AzApplicationInsights'' [#20225]'
144+
# ReleaseNotes = ''
145145

146146
# Prerelease string of this module
147147
# Prerelease = ''

src/ApplicationInsights/Az.ApplicationInsights.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
}
3434

3535
if(-not $accountsModule) {
36-
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. For installation instructions, please see: https://learn.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop
36+
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. For installation instructions, please see: https://docs.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop
3737
} elseif (($accountsModule.Version -lt [System.Version]'2.7.5') -and (-not $localAccounts)) {
3838
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
3939
}

src/ApplicationInsights/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Added parameter validation for `Get-AzApplicationInsights` [#20697 ]
2122

2223
## Version 2.2.1
2324
* Enabled output object enumerating for `Get-AzApplicationInsights` [#20225]

src/ApplicationInsights/custom/Models/PSApplicationInsightsComponent.cs

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,30 @@ public class PSApplicationInsightsComponent
2424
{
2525
public PSApplicationInsightsComponent(ApplicationInsightsComponent component)
2626
{
27-
this.ResourceGroupName = ParseResourceGroupFromId(component.Id);
28-
this.Name = component.Name;
29-
this.Id = component.Id;
30-
this.Location = component.Location;
31-
this.Tags = component.Tag.Keys.ToDictionary(x => x, x => component.Tag[x]);
32-
this.Kind = component.Kind;
33-
this.Type = component.Type;
34-
this.AppId = component.AppId;
35-
this.ApplicationId = component.ApplicationId;
36-
this.ApplicationType = component.ApplicationType;
37-
this.CreationDate = component.CreationDate;
38-
this.FlowType = component.FlowType;
39-
this.HockeyAppId = component.HockeyAppId;
40-
this.HockeyAppToken = component.HockeyAppToken;
41-
this.InstrumentationKey = component.InstrumentationKey;
42-
this.ProvisioningState = component.ProvisioningState;
43-
this.RequestSource = component.RequestSource;
44-
this.SamplingPercentage = component.SamplingPercentage;
45-
this.TenantId = component.TenantId;
46-
this.PublicNetworkAccessForIngestion = component.PublicNetworkAccessForIngestion;
47-
this.PublicNetworkAccessForQuery = component.PublicNetworkAccessForQuery;
48-
this.PrivateLinkScopedResources = component.PrivateLinkScopedResource.ToList();
49-
this.RetentionInDays = component.RetentionInDay;
50-
this.ConnectionString = component.ConnectionString;
27+
this.ResourceGroupName = ParseResourceGroupFromId(component?.Id);
28+
this.Name = component?.Name;
29+
this.Id = component?.Id;
30+
this.Location = component?.Location;
31+
this.Tags = component?.Tag?.Keys?.ToDictionary(x => x, x => component.Tag[x]);
32+
this.Kind = component?.Kind;
33+
this.Type = component?.Type;
34+
this.AppId = component?.AppId;
35+
this.ApplicationId = component?.ApplicationId;
36+
this.ApplicationType = component?.ApplicationType;
37+
this.CreationDate = component?.CreationDate;
38+
this.FlowType = component?.FlowType;
39+
this.HockeyAppId = component?.HockeyAppId;
40+
this.HockeyAppToken = component?.HockeyAppToken;
41+
this.InstrumentationKey = component?.InstrumentationKey;
42+
this.ProvisioningState = component?.ProvisioningState;
43+
this.RequestSource = component?.RequestSource;
44+
this.SamplingPercentage = component?.SamplingPercentage;
45+
this.TenantId = component?.TenantId;
46+
this.PublicNetworkAccessForIngestion = component?.PublicNetworkAccessForIngestion;
47+
this.PublicNetworkAccessForQuery = component?.PublicNetworkAccessForQuery;
48+
this.PrivateLinkScopedResources = component?.PrivateLinkScopedResource?.ToList();
49+
this.RetentionInDays = component?.RetentionInDay;
50+
this.ConnectionString = component?.ConnectionString;
5151
}
5252

5353
public string Id { get; set; }
@@ -145,7 +145,7 @@ public PSApplicationInsightsComponentWithPricingPlan(ApplicationInsightsComponen
145145
ApplicationInsightsComponentQuotaStatus status)
146146
: base(component)
147147
{
148-
if (billing.CurrentBillingFeature.Any(f => f.Contains("Enterprise")))
148+
if (billing != null && billing.CurrentBillingFeature != null && billing.CurrentBillingFeature.Any(f => f.Contains("Enterprise")))
149149
{
150150
this.PricingPlan = "Application Insights Enterprise";
151151
}
@@ -154,11 +154,13 @@ public PSApplicationInsightsComponentWithPricingPlan(ApplicationInsightsComponen
154154
this.PricingPlan = billing.CurrentBillingFeature.FirstOrDefault();
155155
}
156156

157-
this.Cap = billing.DataVolumeCap.Cap;
158-
this.ResetTime = billing.DataVolumeCap.ResetTime;
159-
this.StopSendNotificationWhenHitCap = billing.DataVolumeCap.StopSendNotificationWhenHitCap.Value;
160-
this.CapExpirationTime = status.ExpirationTime;
161-
this.IsCapped = status.ShouldBeThrottled != null ? status.ShouldBeThrottled.Value : false;
157+
this.Cap = billing?.DataVolumeCap?.Cap;
158+
this.ResetTime = billing?.DataVolumeCap?.ResetTime;
159+
if (billing != null && billing.DataVolumeCap != null && billing.DataVolumeCap.StopSendNotificationWhenHitCap != null) {
160+
this.StopSendNotificationWhenHitCap = billing.DataVolumeCap.StopSendNotificationWhenHitCap.Value;
161+
}
162+
this.CapExpirationTime = status?.ExpirationTime;
163+
this.IsCapped = status?.ShouldBeThrottled != null ? status.ShouldBeThrottled.Value : false;
162164
}
163165
}
164166
}

src/ApplicationInsights/custom/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ These provide functionality to our HTTP pipeline and other useful features. In s
3232
### Attributes
3333
For processing the cmdlets, we've created some additional attributes:
3434
- `Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.DescriptionAttribute`
35-
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
35+
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
3636
- `Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.DoNotExportAttribute`
3737
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.ApplicationInsights`.
3838
- `Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.InternalExportAttribute`

src/ApplicationInsights/exports/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Exports
2-
This directory contains the cmdlets *exported by* `Az.ApplicationInsights`. No other cmdlets in this repository are directly exported. What that means is the `Az.ApplicationInsights` module will run [Export-ModuleMember](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/export-modulemember) on the cmldets in this directory. The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation.
2+
This directory contains the cmdlets *exported by* `Az.ApplicationInsights`. No other cmdlets in this repository are directly exported. What that means is the `Az.ApplicationInsights` module will run [Export-ModuleMember](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/export-modulemember) on the cmldets in this directory. The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation.
33

44
## Info
55
- Modifiable: no
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"swagger_commit": "f3e7c1b20f032a637069d055524549b950830c22",
2+
"swagger_commit": "90a294fca4845153be79d926b7415be5375522ac",
33
"node": "v14.15.5",
44
"autorest": "`-- (empty)",
5-
"autorest_core": "3.9.3",
5+
"autorest_core": "3.9.4",
66
"autorest_modelerfour": "4.15.414",
77
"autorest_powershell": "3.0.498"
88
}

src/ApplicationInsights/how-to.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ To generate documentation, the process is now integrated into the `build-module.
1414
To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [README.md](examples/README.md) in the `examples` folder.
1515

1616
## Packing `Az.ApplicationInsights`
17-
To pack `Az.ApplicationInsights` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://learn.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team.
17+
To pack `Az.ApplicationInsights` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://docs.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team.
1818

1919
## Module Script Details
2020
There are multiple scripts created for performing different actions for developing `Az.ApplicationInsights`.

0 commit comments

Comments
 (0)