Skip to content

Commit

Permalink
Removing binary dependencies for telemetry
Browse files Browse the repository at this point in the history
This reverse engineers the REST API for Application Insights so that
we no longer need to download / depend on the 3 .dll files that were
necessary to use the Application Insights .NET SDK.

This is directly benefitting from the work that was done for
PowerShellForGitHub (see microsoft/PowerShellForGitHub#186)
  • Loading branch information
HowardWolosky committed Aug 23, 2020
1 parent f18939e commit 169b40b
Show file tree
Hide file tree
Showing 4 changed files with 265 additions and 396 deletions.
34 changes: 14 additions & 20 deletions Documentation/SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ potential confusion. At a high level, all you're doing is:
The following section describes how to configure your system for use with StoreBroker,
and lists the available options for installing the module contents.

### ExecutionPolicy
### ExecutionPolicy

Update the `PowerShell ExecutionPolicy` to be `RemoteSigned` (which means
that PowerShell scripts that are local to your machine don't need to be signed in order to execute).
Expand Down Expand Up @@ -165,12 +165,6 @@ StoreBroker has a dependency on dll's from the following NuGet packages:
WindowsAzure.Storage v8.1.1: Microsoft.WindowsAzure.Storage.dll
Microsoft.Azure.Storage.DataMovement v0.5.1: Microsoft.WindowsAzure.Storage.DataMovement.dll

**For [Telemetry](USAGE.md#telemetry)**

Microsoft.ApplicationInsights v2.0.1: Microsoft.ApplicationInsights.dll"
Microsoft.Diagnostics.Tracing.EventSource.Redist v1.1.24: Microsoft.Diagnostics.Tracing.EventSource.dll
Microsoft.Bcl.Async v1.0.168.0: Microsoft.Threading.Tasks.dll

During execution of a command, when StoreBroker has need for an object from one of these dll's,
if it cannot find the dll, it will automatically download nuget.exe, then download the nuget
package that the assembly is in, and finally cache it for the duration of your PowerShell session.
Expand Down Expand Up @@ -205,7 +199,7 @@ To initially configure StoreBroker with your Developer Account:

2. You must [associate your AAD with your Dev Center account](https://msdn.microsoft.com/windows/uwp/monetize/create-and-manage-submissions-using-windows-store-services#associate-an-azure-ad-application-with-your-windows-dev-center-account)
to obtain the credentials to allow StoreBroker to access your account and perform actions on
your behalf.
your behalf.

3. The app you want to publish must already exist. The Windows Store Submission API can only
publish updates to existing applications. You can
Expand All @@ -217,7 +211,7 @@ To initially configure StoreBroker with your Developer Account:
submission, the Update attempt will fail.


> These prerequisites come directly from the
> These prerequisites come directly from the
> [API Documentation](https://msdn.microsoft.com/windows/uwp/monetize/create-and-manage-submissions-using-windows-store-services).
> Refer to that documentation for additional prerequisites.
Expand Down Expand Up @@ -248,10 +242,10 @@ To get those values:
account, and assign it the **Manager** role. If this application already exists in your AAD,
you can select it on the **Add Azure AD applications** page to add it to your Dev Center account.
Otherwise, you can create a new AAD application on the **Add Azure AD applications** page.
For more information, see [Add and manage Azure AD applications](https://msdn.microsoft.com/windows/uwp/publish/manage-account-users#add-and-manage-azure-ad-applications).
For more information, see [Add and manage Azure AD applications](https://msdn.microsoft.com/windows/uwp/publish/manage-account-users#add-and-manage-azure-ad-applications).

3. Return to the **Manage users** page, click the name of your Azure AD application to go to the
application settings, and copy the **Tenant ID** and **Client ID** values.
application settings, and copy the **Tenant ID** and **Client ID** values.

4. Click **Add new key**. On the following screen, copy the **Key** value, which corresponds to the
**Client secret**. You *will not* be able to access this info again after you leave this page,
Expand Down Expand Up @@ -292,12 +286,12 @@ One way to do this would be the following:
3. Now you can store the password somewhere on disk securely. Doing this will encrypt the
password into a plain-text file, and only the same user logged-in to the exact same computer
will be able to decrypt it.

$cred.Password | ConvertFrom-SecureString | Set-Content -Path (Join-Path -Path ([System.Environment]::GetFolderPath('MyDocuments')) -ChildPath 'clientSecret.txt')

4. When you want to create the credentials yourself later on and authenticate (being sure to
replace `<tenantId>` and `<clientId>` with the proper values):

$clientSecret = Get-Content -Path (Join-Path -Path ([System.Environment]::GetFolderPath('MyDocuments')) -ChildPath 'clientSecret.txt') | ConvertTo-SecureString
$cred = New-Object System.Management.Automation.PSCredential "<clientId>", $clientSecret
Set-StoreBrokerAuthentication -TenantId <tenantId> -Credential $cred
Expand Down Expand Up @@ -348,7 +342,7 @@ That setting (being configured to use the proxy) will be stored for the duration
> the profile for you. Then, just add those 3 lines of code from Step 4 into your profile.
To stop authenticating with the proxy, at any time simply close your PowerShell console window, or
call:
call:

Clear-StoreBrokerAuthentication

Expand Down Expand Up @@ -403,7 +397,7 @@ started by generating your app's PDP files based on your current published submi

Where:
* `<appId>` is your app's ID.

* `<release>` is the name of this release. Many teams name their releases as `YYMM`
(depending on how often they release). This value will be added to each of the PDP's that are
generated, and will impact the expected location of the screenshots being referenced. More on
Expand Down Expand Up @@ -453,7 +447,7 @@ Every project should have its own StoreBroker config file. The config file has
dynamically during your build from a localization service/process, leave both blank and
only specify `PDPRootPath` at the commandline so that you can use environment variables
to reference the local path, and move on to "**ii**".

Otherwise, it's necessary for you to provide the path that the PDP's can be found.
You'll do this with a combination of these two config values. The general idea
is that you have a root folder for PDP's that contains sub-folders named after each
Expand All @@ -480,7 +474,7 @@ Every project should have its own StoreBroker config file. The config file has
be updated with the most recent PDP's, use the first method. If you _will_ be using
release-named sub-folders to organize your PDP's, then you may wish to use the second
option, and you can either choose to update your config file with the new release name
every time it changes, or provide it at the commandline instead. Your choice.
every time it changes, or provide it at the commandline instead. Your choice.

> Remember that you have to escape any backslashes used in the config file.
Expand Down Expand Up @@ -508,11 +502,11 @@ Every project should have its own StoreBroker config file. The config file has
Screenshot2.png

you would specify `\\share\MyApp\Images\` as your `ImagesRootPath`, and your PDP file
would set `201605` as the `Release` attribute (at the very top of the file).
would set `201605` as the `Release` attribute (at the very top of the file).
`New-SubmissionPackage` would then combine those together at runtime to get the
full path to these images.

> Remember that you have to escape any backslashes used in the config file.
> Remember that you have to escape any backslashes used in the config file.
vi. `AppxPath` - Follow the guidance in the help comments to correctly specify where the appx
packages for your app will be found. Since this is likely part of your build output, you'll
Expand Down Expand Up @@ -575,7 +569,7 @@ started by generating your IAP's PDP files based on your current published (or p

Where:
* `<iapId>` is your IAP's ID.

* `<release>` is the name of this release. Many teams name their releases as `YYMM`
(depending on how often they release). This value will be added to each of the PDP's that are
generated, and will impact the expected location of the screenshots being referenced. More on
Expand Down
2 changes: 1 addition & 1 deletion StoreBroker/Helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ function Get-HttpWebResponseContent
{
$content = $null

if ($WebResponse.ContentLength -gt 0)
if (($null -ne $WebResponse) -and ($WebResponse.ContentLength -gt 0))
{
$stream = $WebResponse.GetResponseStream()
$encoding = [System.Text.Encoding]::UTF8
Expand Down
2 changes: 1 addition & 1 deletion StoreBroker/StoreBroker.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
CompanyName = 'Microsoft Corporation'
Copyright = 'Copyright (C) Microsoft Corporation. All rights reserved.'

ModuleVersion = '1.19.4'
ModuleVersion = '1.20.0'
Description = 'Provides command-line access to the Windows Store Submission REST API.'

RootModule = 'StoreIngestionApi'
Expand Down
Loading

0 comments on commit 169b40b

Please sign in to comment.