simeoncloud / IntuneAppBuilder

A cross platform, Intune application packaging and deployment console tool and SDK :zap:
https://simeoncloud.com
Apache License 2.0
60 stars 3 forks source link

Ability to re-use the authenticated session to publish package #31

Closed kitos9112 closed 1 year ago

kitos9112 commented 1 year ago

Hi,

Firstly, many thanks for open-sourcing this app, it worked like a charm. I had to replace the GitVersionTask module though. Dropping it here for the record:

diff --git a/GitVersion.proj_ b/GitVersion.proj_
index 75308e5..4190941 100644
--- a/GitVersion.proj_
+++ b/GitVersion.proj_
@@ -1,4 +1,7 @@
 <Project>
+<PropertyGroup>
+    <PublishSingleFile>true</PublishSingleFile>
+</PropertyGroup>
     <PropertyGroup>
         <BaseIntermediateOutputPath>$(SolutionDir)/.tmp/GitVersion/obj</BaseIntermediateOutputPath>
         <OutputPath>$(SolutionDir)/.tmp/GitVersion/bin</OutputPath>
@@ -6,7 +9,7 @@
     <Import Project="$(MSBuildBinPath)/Microsoft.Common.CurrentVersion.targets" />
     <Import Project="$(BaseIntermediateOutputPath)/$(MSBuildThisFileName)$(MSBuildThisFileExtension).nuget.g.targets" Condition="Exists('$(BaseIntermediateOutputPath)/$(MSBuildThisFileName)$(MSBuildThisFileExtension).nuget.g.targets')" />
     <ItemGroup>
-           <PackageReference Include="GitVersionTask" Version="5.5.1" />
+           <PackageReference Include="GitVersion.MsBuild" Version="5.12.0" />
     </ItemGroup>
     <Target Name="Build" DependsOnTargets="GetVersion;WriteVersionInfoToBuildLog" Returns="$(GitVersion_NuGetVersion)" />
 </Project>
(END)

Although my question is about re-using the current session credentials (e.g., az cache) rather than having to enter a device code for the publish subcommand. Would that be possible?

ashek-simeon commented 1 year ago

Hi @kitos9112 ! Would you be willing to share what issue the change to the GitVersionTask module is intended to address?

kitos9112 commented 1 year ago

Hey @ashek-simeon! It was intended to run the app on my Linux environment. The actual GitVersionTask is deprecated https://www.nuget.org/packages/GitVersionTask in favour of https://www.nuget.org/packages/GitVersion.MsBuild

kitos9112 commented 1 year ago

Although that was a side issue I managed to overcome, do you reckon it would be possible to upload the win32 binary by reusing the local creds?

ashek-simeon commented 1 year ago

@kitos9112 we are considering adding an optional access token parameter to the command, as follows:

IntuneAppBuilder publish --source .\MyAppPackage\MyAppInstallFiles.intunewin.json --accesstoken {insert access token}

Would that change meet your needs?

kitos9112 commented 1 year ago

Hmm that'd do the trick. I can retrieve a JWT token leveraging the AZ cli or the MS graph Powershell module.

A bit concerned that the token would get leaked in the shell history though. However, that'd not matter much as these tokens are short lived regardless.

ashek-simeon commented 1 year ago

We now have a pull request open to add a token parameter to the publish command, among other changes.

@kitos9112 To retrieve a token that can be used to publish, one option may be to use the scope and client ID that IntuneAppBuilder app uses.

kitos9112 commented 1 year ago

Ah, yes. I'd have to do an admin approval once for the whole directory. Then, I can run it non-interactively by retrieving a JWT token with the right scope. Thanks for pointing that out!

I'll keep an eye on the releases. Many thanks for tackling it too. @ashek-simeon

ashek-simeon commented 1 year ago

You're welcome, @kitos9112 . The optional token parameter for the publish command has been merged and released in version 3.0.0 of the NuGet package