File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 18
18
- Additional information about change #1
19
19
-->
20
20
## Upcoming Release
21
+ * Used AAD Auth instead of Basic Auth for PublishAzureWebApps
21
22
22
23
## Version 2.15.0
23
24
* Fixed Tag parameter issues with ASE for ` New-AzWebApp `
Original file line number Diff line number Diff line change 14
14
// ----------------------------------------------------------------------------------
15
15
16
16
17
+ using Microsoft . Azure . Commands . Common . Authentication ;
17
18
using Microsoft . Azure . Commands . WebApps . Models ;
18
19
using Microsoft . Azure . Management . WebSites . Models ;
19
20
using Microsoft . WindowsAzure . Commands . Utilities . Common ;
22
23
using System . Management . Automation ;
23
24
using System . Net ;
24
25
using System . Net . Http ;
26
+ using System . Net . Http . Headers ;
25
27
using System . Text ;
26
28
using System . Threading ;
27
29
@@ -85,8 +87,9 @@ public override void ExecuteCmdlet()
85
87
client . Timeout = TimeSpan . FromMilliseconds ( Timeout ) ;
86
88
}
87
89
88
- var byteArray = Encoding . ASCII . GetBytes ( user . PublishingUserName + ":" + user . PublishingPassword ) ;
89
- client . DefaultRequestHeaders . Authorization = new System . Net . Http . Headers . AuthenticationHeaderValue ( "Basic" , Convert . ToBase64String ( byteArray ) ) ;
90
+ var token = WebsitesClient . GetAccessToken ( DefaultContext ) ;
91
+ client . DefaultRequestHeaders . Authorization = new System . Net . Http . Headers . AuthenticationHeaderValue ( "Bearer" , token . AccessToken ) ;
92
+
90
93
HttpContent fileContent = new StreamContent ( s ) ;
91
94
fileContent . Headers . ContentType = new System . Net . Http . Headers . MediaTypeHeaderValue ( "application/zip" ) ;
92
95
r = client . PostAsync ( deployUrl , fileContent ) . Result ;
@@ -126,6 +129,5 @@ public override void ExecuteCmdlet()
126
129
PSSite app = new PSSite ( WebsitesClient . GetWebApp ( ResourceGroupName , Name , Slot ) ) ;
127
130
WriteObject ( app ) ;
128
131
}
129
-
130
132
}
131
133
}
You can’t perform that action at this time.
0 commit comments