Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
abf6f37
invoke-azrest (#12291)
VeryEarly Jul 1, 2020
ba9dfa7
fix static analysis error for Azure.Core (#12293)
erich-wang Jul 1, 2020
fa0234e
New Powershell commands for Subscription RP (#12077)
navysingla Jul 1, 2020
9562911
String with escape chars cannot be converted into json object (#12283)
wyunchi-ms Jul 1, 2020
598cef5
[Synapse] Make Synapse PowerShell consume track 2 Spark SDK (#12202)
wonner Jul 1, 2020
f3a2390
Modifying the HelpText for AzRecoveryServiceBackup cmdlets (#12271)
hiaga Jul 2, 2020
51770dd
Update private link (#12302)
dingmeng-xue Jul 2, 2020
86382dd
Create Unregister-AzResourceProvider Cmdlet (#12273)
diwudd Jul 2, 2020
9a4af9d
Remove Sha256Checksum parameter of example of New-AzImageBuilderCusto…
LucasYao93 Jul 3, 2020
21719e6
Introducing Az.Security AllowedConnection cmdlets (#12233)
ariklin Jul 3, 2020
ffc760c
adding warning when using new-azvmss and not using "latest" image ver…
grizzlytheodore Jul 3, 2020
f16ce88
Az.DataFactory update to include Global Parameters (#12290)
Ceespino Jul 3, 2020
8f8f3df
Adding support for fetching MAB agent jobs (#12308)
hiaga Jul 3, 2020
06b4238
[Synapse] Add access control cmdlets (#12309)
wonner Jul 3, 2020
9d46506
remove unused netstandard2.0 from TargetFrameworks for test projects …
erich-wang Jul 3, 2020
7247176
AzureEventGrid: Add Powershell cmdlets for 2020-06-01 API Version (#1…
ahamad-MS Jul 6, 2020
8196a99
Fix bug: Get-AzAks doesn't get all clusters (#12319)
erich-wang Jul 6, 2020
81c3f16
Update Add-AzApplicationGatewayBackendAddressPool.md (#12321)
Antse Jul 6, 2020
602a49e
Add default provider support to Az.Attestation module (#12317)
yinqchen Jul 6, 2020
81b6b3f
{HDInsight} Support creating cluster with ADLSGen1/2 storage in natio…
aim-for-better Jul 6, 2020
c3220a2
Authentication.csproj should not be referenced by module project (#12…
erich-wang Jul 6, 2020
a703779
Example 1 - -AllowBranchToBranchTraffic $true (#12326)
nthewara Jul 6, 2020
7dd629f
Remove signature issues in artifacts (#12334)
VeryEarly Jul 6, 2020
34eaab1
Remove useless files (#12336)
dingmeng-xue Jul 7, 2020
6aa258f
[Storage] Support Blobversion with Track2 SDK (#12323)
blueww Jul 7, 2020
c733cde
fix merge conflicts
blueww Jul 7, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions src/Accounts/Accounts.Test/ErrorResolutionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ public void HandlesExceptionError()
var autorestException = new Microsoft.Rest.Azure.CloudException("exception message")
{
Body = new Microsoft.Rest.Azure.CloudError { Code = "AutorestCode", Message = "Autorest message" },
Request = new Rest.HttpRequestMessageWrapper(request, ""),
Response = new Rest.HttpResponseMessageWrapper(response, ""),
Request = new Microsoft.Rest.HttpRequestMessageWrapper(request, ""),
Response = new Microsoft.Rest.HttpResponseMessageWrapper(response, ""),
RequestId = "AutoRestRequestId"
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,24 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Management.MachineLearningCompute.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.Azure.Commands.MachineLearningCompute.Models
namespace Microsoft.Azure.Commands.Profile.Test
{
class PSUpdateSystemServicesResponse : UpdateSystemServicesResponse
public class InvokeAzRestTests : AccountsTestRunner
{
public PSUpdateSystemServicesResponse(UpdateSystemServicesResponse response)
: base(response.UpdateStatus, response.UpdateStartedOn, response.UpdateCompletedOn)
public InvokeAzRestTests(ITestOutputHelper output)
: base(output)
{
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestInvokeAzRest()
{
TestRunner.RunTestScript("Test-InvokeAzRest");
}
}
}
54 changes: 54 additions & 0 deletions src/Accounts/Accounts.Test/InvokeAzRestTests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# -----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------

<#
.SYNOPSIS
Tests cmdlets Invoke-AzRest
#>

function Test-InvokeAzRest
{
$put = "PUT"
$get = "GET"
$patch = "PATCH"
$delete = "DELETE"
$api = "2019-10-01"
$name = "mockRG4Test"

$tag = "`{`"tags`": `{`"key`": `"val`"`}`}"
$payload = "`{`"Location`": `"eastus`"`}"

$response = Invoke-AzRest -ResourceGroupName $name -ApiVersion $api -Method $put -payload $payload

Assert-AreEqual 201 $response.StatusCode
Assert-AreEqual $put $response.Method
Assert-NotNull $response.Content

$response = Invoke-AzRest -ResourceGroupName $name -ApiVersion $api -Method $get

Assert-AreEqual 200 $response.StatusCode
Assert-AreEqual $get $response.Method
Assert-NotNull $response.Content

$response = Invoke-AzRest -ResourceGroupName $name -ApiVersion $api -Method $patch -payload $tag

Assert-AreEqual 200 $response.StatusCode
Assert-AreEqual $patch $response.Method
Assert-NotNull $response.Content

$response = Invoke-AzRest -ResourceGroupName $name -ApiVersion $api -Method $delete

Assert-AreEqual 202 $response.StatusCode
Assert-AreEqual $delete $response.Method
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
{
"Entries": [
{
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/mockRG4Test?api-version=2019-10-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Jlc291cmNlR3JvdXBzL21vY2tSRzRUZXN0P2FwaS12ZXJzaW9uPTIwMTktMTAtMDE=",
"RequestMethod": "PUT",
"RequestBody": "{\r\n \"Location\": \"eastus\"\r\n}",
"RequestHeaders": {
"x-ms-client-request-id": [
"81de12fa-bbcf-47d5-a8fd-943c1ad886e1"
],
"Accept-Language": [
"en-US"
],
"User-Agent": [
"FxVersion/4.6.28928.01",
"OSName/Windows",
"OSVersion/Microsoft.Windows.10.0.18363.",
"Microsoft.Azure.Internal.Common.AzureRestClient/1.3.17"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Content-Length": [
"22"
]
},
"ResponseHeaders": {
"Cache-Control": [
"no-cache"
],
"Pragma": [
"no-cache"
],
"x-ms-ratelimit-remaining-subscription-writes": [
"1199"
],
"x-ms-request-id": [
"7cc85e9c-718e-4ce9-92cd-76098f863590"
],
"x-ms-correlation-request-id": [
"7cc85e9c-718e-4ce9-92cd-76098f863590"
],
"x-ms-routing-request-id": [
"SOUTHEASTASIA:20200630T032251Z:7cc85e9c-718e-4ce9-92cd-76098f863590"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"X-Content-Type-Options": [
"nosniff"
],
"Date": [
"Tue, 30 Jun 2020 03:22:51 GMT"
],
"Content-Length": [
"219"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Expires": [
"-1"
]
},
"ResponseBody": "{\r\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/mockRG4Test\",\r\n \"name\": \"mockRG4Test\",\r\n \"type\": \"Microsoft.Resources/resourceGroups\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}",
"StatusCode": 201
},
{
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/mockRG4Test?api-version=2019-10-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Jlc291cmNlR3JvdXBzL21vY2tSRzRUZXN0P2FwaS12ZXJzaW9uPTIwMTktMTAtMDE=",
"RequestMethod": "GET",
"RequestBody": "",
"RequestHeaders": {
"x-ms-client-request-id": [
"d64d1bd0-4477-4d0f-b846-10fd6344bb1a"
],
"Accept-Language": [
"en-US"
],
"User-Agent": [
"FxVersion/4.6.28928.01",
"OSName/Windows",
"OSVersion/Microsoft.Windows.10.0.18363.",
"Microsoft.Azure.Internal.Common.AzureRestClient/1.3.17"
]
},
"ResponseHeaders": {
"Cache-Control": [
"no-cache"
],
"Pragma": [
"no-cache"
],
"x-ms-ratelimit-remaining-subscription-reads": [
"11994"
],
"x-ms-request-id": [
"3812dcc9-0254-4fe9-b88f-40706ff4a59a"
],
"x-ms-correlation-request-id": [
"3812dcc9-0254-4fe9-b88f-40706ff4a59a"
],
"x-ms-routing-request-id": [
"SOUTHEASTASIA:20200630T032251Z:3812dcc9-0254-4fe9-b88f-40706ff4a59a"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"X-Content-Type-Options": [
"nosniff"
],
"Date": [
"Tue, 30 Jun 2020 03:22:51 GMT"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Expires": [
"-1"
],
"Content-Length": [
"219"
]
},
"ResponseBody": "{\r\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/mockRG4Test\",\r\n \"name\": \"mockRG4Test\",\r\n \"type\": \"Microsoft.Resources/resourceGroups\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}",
"StatusCode": 200
},
{
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/mockRG4Test?api-version=2019-10-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Jlc291cmNlR3JvdXBzL21vY2tSRzRUZXN0P2FwaS12ZXJzaW9uPTIwMTktMTAtMDE=",
"RequestMethod": "PATCH",
"RequestBody": "{\r\n \"tags\": {\r\n \"key\": \"val\"\r\n }\r\n}",
"RequestHeaders": {
"x-ms-client-request-id": [
"28343bc5-2bb1-4156-b4a4-aa5d93f6d5a1"
],
"Accept-Language": [
"en-US"
],
"User-Agent": [
"FxVersion/4.6.28928.01",
"OSName/Windows",
"OSVersion/Microsoft.Windows.10.0.18363.",
"Microsoft.Azure.Internal.Common.AzureRestClient/1.3.17"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Content-Length": [
"24"
]
},
"ResponseHeaders": {
"Cache-Control": [
"no-cache"
],
"Pragma": [
"no-cache"
],
"x-ms-ratelimit-remaining-subscription-writes": [
"1196"
],
"x-ms-request-id": [
"61d06e8b-185e-4c2e-a7b3-83a92c0b252b"
],
"x-ms-correlation-request-id": [
"61d06e8b-185e-4c2e-a7b3-83a92c0b252b"
],
"x-ms-routing-request-id": [
"SOUTHEASTASIA:20200630T032254Z:61d06e8b-185e-4c2e-a7b3-83a92c0b252b"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"X-Content-Type-Options": [
"nosniff"
],
"Date": [
"Tue, 30 Jun 2020 03:22:54 GMT"
],
"Content-Length": [
"240"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Expires": [
"-1"
]
},
"ResponseBody": "{\r\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/mockRG4Test\",\r\n \"name\": \"mockRG4Test\",\r\n \"type\": \"Microsoft.Resources/resourceGroups\",\r\n \"location\": \"eastus\",\r\n \"tags\": {\r\n \"key\": \"val\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}",
"StatusCode": 200
},
{
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/mockRG4Test?api-version=2019-10-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Jlc291cmNlR3JvdXBzL21vY2tSRzRUZXN0P2FwaS12ZXJzaW9uPTIwMTktMTAtMDE=",
"RequestMethod": "DELETE",
"RequestBody": "",
"RequestHeaders": {
"x-ms-client-request-id": [
"3ab6d714-2aea-4d95-a43d-f07e26d47f81"
],
"Accept-Language": [
"en-US"
],
"User-Agent": [
"FxVersion/4.6.28928.01",
"OSName/Windows",
"OSVersion/Microsoft.Windows.10.0.18363.",
"Microsoft.Azure.Internal.Common.AzureRestClient/1.3.17"
]
},
"ResponseHeaders": {
"Cache-Control": [
"no-cache"
],
"Pragma": [
"no-cache"
],
"Location": [
"https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1NT0NLUkc0VEVTVC1FQVNUVVMiLCJqb2JMb2NhdGlvbiI6ImVhc3R1cyJ9?api-version=2019-10-01"
],
"Retry-After": [
"15"
],
"x-ms-ratelimit-remaining-subscription-deletes": [
"14999"
],
"x-ms-request-id": [
"2307c7dc-bddf-42b1-81e0-5b42931cbc56"
],
"x-ms-correlation-request-id": [
"2307c7dc-bddf-42b1-81e0-5b42931cbc56"
],
"x-ms-routing-request-id": [
"SOUTHEASTASIA:20200630T032258Z:2307c7dc-bddf-42b1-81e0-5b42931cbc56"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"X-Content-Type-Options": [
"nosniff"
],
"Date": [
"Tue, 30 Jun 2020 03:22:57 GMT"
],
"Expires": [
"-1"
],
"Content-Length": [
"0"
]
},
"ResponseBody": "",
"StatusCode": 202
}
],
"Names": {},
"Variables": {
"SubscriptionId": "9e223dbe-3399-4e19-88eb-0975f02ac87f"
}
}
5 changes: 3 additions & 2 deletions src/Accounts/Accounts/Az.Accounts.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,16 @@ CmdletsToExport = 'Disable-AzDataCollection', 'Disable-AzContextAutosave',
'Disconnect-AzAccount', 'Get-AzContextAutosaveSetting',
'Set-AzDefault', 'Get-AzDefault', 'Clear-AzDefault',
'Register-AzModule', 'Enable-AzureRmAlias', 'Disable-AzureRmAlias',
'Uninstall-AzureRm', 'Get-AzProfile', 'Select-AzProfile'
'Uninstall-AzureRm', 'Get-AzProfile', 'Select-AzProfile',
'Invoke-AzRestMethod'

# Variables to export from this module
# VariablesToExport = @()

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = 'Add-AzAccount', 'Login-AzAccount', 'Remove-AzAccount',
'Logout-AzAccount', 'Select-AzSubscription', 'Resolve-Error',
'Save-AzProfile', 'Get-AzDomain'
'Save-AzProfile', 'Get-AzDomain', 'Invoke-AzRest'

# DSC resources to export from this module
# DscResourcesToExport = @()
Expand Down
1 change: 1 addition & 0 deletions src/Accounts/Accounts/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Added new cmdlet `Invoke-AzRestMethod`

* Fixed an issue that may cause authentication errors in multi-process scenarios such as running multiple Azure PowerShell cmdlets using `Start-Job` [#9448]

Expand Down
Loading