Skip to content

Commit 603a9e9

Browse files
committed
Refresh from upstream dev
2 parents 5758af7 + 30a3d83 commit 603a9e9

File tree

538 files changed

+108795
-34843
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

538 files changed

+108795
-34843
lines changed

.github/policies/resourceManagement.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,19 @@ configuration:
585585
- kushagraThapar
586586
replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}.
587587
assignMentionees: False
588+
- if:
589+
- hasLabel:
590+
label: Service Attention
591+
- hasLabel:
592+
label: AzureDataTransfer
593+
then:
594+
- mentionUsers:
595+
mentionees:
596+
- lasuredd-msft
597+
- fzkhan
598+
- pkuma-msft
599+
replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}.
600+
assignMentionees: False
588601
- if:
589602
- hasLabel:
590603
label: Service Attention
@@ -2245,6 +2258,19 @@ configuration:
22452258
- AzMonEssential
22462259
replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}.
22472260
assignMentionees: False
2261+
- if:
2262+
- hasLabel:
2263+
label: Service Attention
2264+
- hasLabel:
2265+
label: Monitor - ScheduledQueryRule
2266+
then:
2267+
- mentionUsers:
2268+
mentionees:
2269+
- azmonapplicationinsights
2270+
- asafst
2271+
- efratbp
2272+
replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}.
2273+
assignMentionees: False
22482274
- if:
22492275
- hasLabel:
22502276
label: Service Attention
@@ -2676,6 +2702,7 @@ configuration:
26762702
- mentionUsers:
26772703
mentionees:
26782704
- jfggdl
2705+
- damodaravadhani
26792706
replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}.
26802707
assignMentionees: False
26812708
- if:
@@ -2723,6 +2750,17 @@ configuration:
27232750
- stephbaron
27242751
replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}.
27252752
assignMentionees: False
2753+
- if:
2754+
- hasLabel:
2755+
label: Service Attention
2756+
- hasLabel:
2757+
label: ResourceMover
2758+
then:
2759+
- mentionUsers:
2760+
mentionees:
2761+
- yashjain4
2762+
replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}.
2763+
assignMentionees: False
27262764
- if:
27272765
- hasLabel:
27282766
label: Service Attention

scripts/regression_test/extension_regression_test.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ jobs:
2121
inputs:
2222
versionSpec: '3.12'
2323
displayName: "Use Python 3.12"
24-
- bash: |
24+
- task: AzureCLI@2
25+
displayName: 'checkout branch'
26+
inputs:
27+
connectedServiceNameARM: $(azure-cli-live-test-msft-connected-service)
28+
scriptType: bash
29+
scriptLocation: inlineScript
30+
inlineScript: |
2531
set -ev
2632
pwd
2733
git clone https://github.com/Azure/azure-cli-extensions.git
@@ -34,7 +40,6 @@ jobs:
3440
git remote add azclibot https://azclibot:${GITHUB_TOKEN}@github.com/azclibot/azure-cli-extensions.git
3541
git checkout -b regression_test_$(Build.BuildId)
3642
git push --set-upstream azclibot regression_test_$(Build.BuildId)
37-
displayName: 'checkout branch'
3843
3944
- job: CLIExtensionRegressionTest
4045
displayName: CLI Extension Regression Test
@@ -74,7 +79,13 @@ jobs:
7479
inputs:
7580
versionSpec: '3.12'
7681
displayName: "Use Python 3.12"
77-
- bash: |
82+
- task: AzureCLI@2
83+
displayName: 'checkout cli and extension repo'
84+
inputs:
85+
connectedServiceNameARM: $(azure-cli-live-test-msft-connected-service)
86+
scriptType: bash
87+
scriptLocation: inlineScript
88+
inlineScript: |
7889
set -ev
7990
pwd
8091
if [[ -n "$(CUSTOM_CLI_REPO)" && -n "$(CUSTOM_CLI_BRANCH)" ]]; then
@@ -94,7 +105,6 @@ jobs:
94105
95106
git fetch azclibot
96107
git checkout -b regression_test_$(Build.BuildId) azclibot/regression_test_$(Build.BuildId)
97-
displayName: 'checkout cli and extension repo'
98108
- template: ../../.azure-pipelines/templates/azdev_setup.yml
99109
parameters:
100110
CLIExtensionRepoPath: ./azure-cli-extensions
@@ -153,7 +163,13 @@ jobs:
153163
pool:
154164
name: ${{ variables.ubuntu_pool }}
155165
steps:
156-
- bash: |
166+
- task: AzureCLI@2
167+
displayName: 'Result Summary'
168+
inputs:
169+
connectedServiceNameARM: $(azure-cli-live-test-msft-connected-service)
170+
scriptType: bash
171+
scriptLocation: inlineScript
172+
inlineScript: |
157173
set -ev
158174
159175
# git config
@@ -195,4 +211,3 @@ jobs:
195211
196212
sleep 5
197213
done
198-
displayName: 'Result Summary'

scripts/regression_test/regression_test.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ jobs:
2222
inputs:
2323
versionSpec: '3.12'
2424
displayName: "Use Python 3.12"
25-
- bash: |
25+
- task: AzureCLI@2
26+
displayName: 'update version'
27+
inputs:
28+
connectedServiceNameARM: $(azure-cli-live-test-msft-connected-service)
29+
scriptType: bash
30+
scriptLocation: inlineScript
31+
inlineScript: |
2632
set -ev
2733
2834
# git config
@@ -53,7 +59,6 @@ jobs:
5359
git add .
5460
git commit -m "update version"
5561
git push --set-upstream azclibot regression_test_$(Build.BuildId)
56-
displayName: 'update version'
5762
5863
- job: RerunTests
5964
displayName: CLI Regression tests
@@ -86,7 +91,13 @@ jobs:
8691
inputs:
8792
versionSpec: '3.12'
8893
displayName: "Use Python 3.12"
89-
- bash: |
94+
- task: AzureCLI@2
95+
displayName: 'Checkout Target Branch'
96+
inputs:
97+
connectedServiceNameARM: $(azure-cli-live-test-msft-connected-service)
98+
scriptType: bash
99+
scriptLocation: inlineScript
100+
inlineScript: |
90101
set -ev
91102
# git config
92103
if [[ -n "$(CUSTOM_REPO)" && -n "$(CUSTOM_BRANCH)" && -n "$(CUSTOM_GITHUB_TOKEN)" ]]; then
@@ -104,7 +115,6 @@ jobs:
104115
git fetch ${GITHUB_REPO} ${GITHUB_BRANCH}
105116
106117
git checkout -b ${GITHUB_BRANCH} ${GITHUB_REPO}/${GITHUB_BRANCH}
107-
displayName: 'Checkout Target Branch'
108118
- template: ../../.azure-pipelines/templates/azdev_setup.yml
109119
- task: AzureCLI@2
110120
displayName: 'Rerun tests'
@@ -137,7 +147,13 @@ jobs:
137147
pool:
138148
name: ${{ variables.ubuntu_pool }}
139149
steps:
140-
- bash: |
150+
- task: AzureCLI@2
151+
displayName: 'Create PR'
152+
inputs:
153+
connectedServiceNameARM: $(azure-cli-live-test-msft-connected-service)
154+
scriptType: bash
155+
scriptLocation: inlineScript
156+
inlineScript: |
141157
set -ev
142158
# git config
143159
if [[ -n "$(CUSTOM_REPO)" && -n "$(CUSTOM_BRANCH)" && -n "$(CUSTOM_GITHUB_TOKEN)" ]]; then

src/azure-cli-core/HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Release History
66
2.76.0
77
++++++
88
* Resolve CVE-2024-47081 (#31708)
9+
* Provide actionable error recommendation when a command fails because of Multi-Factor Authentication (MFA) policy violation (#31699)
910

1011
2.75.0
1112
++++++

src/azure-cli-core/azure/cli/core/_profile.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def login(self,
172172
use_device_code = True
173173

174174
if use_device_code:
175-
user_identity = identity.login_with_device_code(scopes=scopes)
175+
user_identity = identity.login_with_device_code(scopes=scopes, claims_challenge=claims_challenge)
176176
else:
177177
user_identity = identity.login_with_auth_code(scopes=scopes, claims_challenge=claims_challenge)
178178
else:
@@ -360,17 +360,20 @@ def get_raw_token(self, resource=None, scopes=None, subscription=None, tenant=No
360360

361361
managed_identity_type, managed_identity_id = Profile._parse_managed_identity_account(account)
362362

363+
non_current_tenant_template = ("For {} account, getting access token for non-current tenants is not "
364+
"supported. The specified tenant must be the current tenant "
365+
f"{account[_TENANT_ID]}")
363366
if in_cloud_console() and account[_USER_ENTITY].get(_CLOUD_SHELL_ID):
364367
# Cloud Shell
365-
if tenant:
366-
raise CLIError("Tenant shouldn't be specified for Cloud Shell account")
368+
if tenant and tenant != account[_TENANT_ID]:
369+
raise CLIError(non_current_tenant_template.format('Cloud Shell'))
367370
from .auth.msal_credentials import CloudShellCredential
368371
cred = CloudShellCredential()
369372

370373
elif managed_identity_type:
371374
# managed identity
372-
if tenant:
373-
raise CLIError("Tenant shouldn't be specified for managed identity account")
375+
if tenant and tenant != account[_TENANT_ID]:
376+
raise CLIError(non_current_tenant_template.format('managed identity'))
374377
cred = ManagedIdentityAuth.credential_factory(managed_identity_type, managed_identity_id)
375378
if credential_out:
376379
credential_out['credential'] = cred

src/azure-cli-core/azure/cli/core/auth/identity.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,14 @@ def _prompt_launching_ui(ui=None, **_):
171171
claims_challenge=claims_challenge)
172172
return check_result(result)
173173

174-
def login_with_device_code(self, scopes):
175-
flow = self._msal_app.initiate_device_flow(scopes)
174+
def login_with_device_code(self, scopes, claims_challenge=None):
175+
flow = self._msal_app.initiate_device_flow(scopes, claims_challenge=claims_challenge)
176176
if "user_code" not in flow:
177177
raise ValueError(
178178
"Fail to create device flow. Err: %s" % json.dumps(flow, indent=4))
179179
from azure.cli.core.style import print_styled_text, Style
180180
print_styled_text((Style.WARNING, flow["message"]), file=sys.stderr)
181-
result = self._msal_app.acquire_token_by_device_flow(flow) # By default it will block
181+
result = self._msal_app.acquire_token_by_device_flow(flow, claims_challenge=claims_challenge)
182182
return check_result(result)
183183

184184
def login_with_username_password(self, username, password, scopes):

src/azure-cli-core/azure/cli/core/profiles/_shared.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,7 @@ def default_api_version(self):
187187
ResourceType.MGMT_RESOURCE_MANAGEDAPPLICATIONS: '2019-07-01',
188188
ResourceType.MGMT_NETWORK_PRIVATEDNS: None,
189189
ResourceType.MGMT_KEYVAULT: None,
190-
ResourceType.MGMT_AUTHORIZATION: SDKProfile('2022-04-01', {
191-
'role_definitions': '2022-05-01-preview',
192-
'provider_operations_metadata': '2018-01-01-preview'
193-
}),
190+
ResourceType.MGMT_AUTHORIZATION: None,
194191
ResourceType.MGMT_CONTAINERREGISTRY: SDKProfile('2025-03-01-preview', {
195192
'agent_pools': '2025-03-01-preview',
196193
'tasks': '2025-03-01-preview',
@@ -227,7 +224,7 @@ def default_api_version(self):
227224
ResourceType.MGMT_ARO: '2023-11-22',
228225
ResourceType.MGMT_DATABOXEDGE: '2021-02-01-preview',
229226
ResourceType.MGMT_CUSTOMLOCATION: '2021-03-15-preview',
230-
ResourceType.MGMT_CONTAINERSERVICE: SDKProfile('2025-05-01'),
227+
ResourceType.MGMT_CONTAINERSERVICE: None,
231228
ResourceType.MGMT_APPCONTAINERS: '2022-10-01',
232229
}
233230
}
@@ -236,10 +233,6 @@ def default_api_version(self):
236233
# We should avoid using ad hoc API versions,
237234
# use the version in a profile as much as possible.
238235
AD_HOC_API_VERSIONS = {
239-
ResourceType.MGMT_IOTHUB: {
240-
# src/azure-cli/azure/cli/command_modules/iot/custom.py#iot_hub_devicestream_show
241-
'iot_hub_resource': '2019-07-01-preview',
242-
},
243236
ResourceType.MGMT_APPSERVICE: {
244237
# src/azure-cli/azure/cli/command_modules/appservice/_constants.py:68
245238
'app_service_certificate_orders': '2022-09-01'

src/azure-cli-core/azure/cli/core/tests/test_profile.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,9 +1134,15 @@ def test_get_raw_token_mi_system_assigned(self):
11341134
self.assertEqual(subscription_id, self.test_mi_subscription_id)
11351135
self.assertEqual(tenant_id, self.test_mi_tenant)
11361136

1137-
# verify tenant shouldn't be specified for MSI account
1138-
with self.assertRaisesRegex(CLIError, "Tenant shouldn't be specified"):
1139-
cred, subscription_id, _ = profile.get_raw_token(resource='http://test_resource', tenant=self.tenant_id)
1137+
# Specifying the current tenant is allowed
1138+
cred, subscription_id, tenant_id = profile.get_raw_token(tenant=self.test_mi_tenant)
1139+
self.assertEqual(tenant_id, self.test_mi_tenant)
1140+
1141+
# Specifying a non-current tenant is disallowed
1142+
with self.assertRaisesRegex(CLIError,
1143+
"For managed identity account, getting access token for non-current tenants is "
1144+
"not supported"):
1145+
profile.get_raw_token(tenant='another-tenant')
11401146

11411147
@mock.patch('azure.cli.core.auth.util.now_timestamp', new=now_timestamp_mock)
11421148
@mock.patch('azure.cli.core.auth.msal_credentials.ManagedIdentityCredential', ManagedIdentityCredentialStub)
@@ -1285,9 +1291,15 @@ def cloud_shell_credential_factory():
12851291
self.assertEqual(subscription_id, test_subscription_id)
12861292
self.assertEqual(tenant_id, test_tenant_id)
12871293

1288-
# Verify tenant shouldn't be specified for Cloud Shell account
1289-
with self.assertRaisesRegex(CLIError, 'Cloud Shell'):
1290-
profile.get_raw_token(resource='http://test_resource', tenant=self.tenant_id)
1294+
# Specifying the current tenant is allowed
1295+
cred, subscription_id, tenant_id = profile.get_raw_token(tenant=test_tenant_id)
1296+
self.assertEqual(tenant_id, test_tenant_id)
1297+
1298+
# Specifying a non-current tenant is disallowed
1299+
with self.assertRaisesRegex(CLIError,
1300+
"For Cloud Shell account, getting access token for non-current tenants is "
1301+
"not supported"):
1302+
profile.get_raw_token(tenant='another-tenant')
12911303

12921304
@mock.patch('azure.cli.core.auth.identity.Identity.get_user_credential')
12931305
def test_get_msal_token(self, get_user_credential_mock):

src/azure-cli-core/azure/cli/core/util.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,12 +1164,6 @@ def __exit__(self, exc_type, exc_val, exc_tb):
11641164

11651165

11661166
def _ssl_context():
1167-
if sys.version_info < (3, 4) or (in_cloud_console() and platform.system() == 'Windows'):
1168-
try:
1169-
return ssl.SSLContext(ssl.PROTOCOL_TLS) # added in python 2.7.13 and 3.6
1170-
except AttributeError:
1171-
return ssl.SSLContext(ssl.PROTOCOL_TLSv1)
1172-
11731167
return ssl.create_default_context()
11741168

11751169

src/azure-cli-core/setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
DEPENDENCIES = [
4646
'argcomplete~=3.5.2',
4747
'azure-cli-telemetry==1.1.0.*',
48+
'azure-core~=1.35.0',
4849
'azure-mgmt-core>=1.2.0,<2',
4950
'cryptography',
5051
# On Linux, the distribution (Ubuntu, Debian, etc) and version are logged in telemetry
@@ -54,8 +55,8 @@
5455
'knack~=0.11.0',
5556
'microsoft-security-utilities-secret-masker~=1.0.0b4',
5657
'msal-extensions==1.2.0',
57-
'msal[broker]==1.33.0b1; sys_platform == "win32"',
58-
'msal==1.33.0b1; sys_platform != "win32"',
58+
'msal[broker]==1.34.0b1; sys_platform == "win32"',
59+
'msal==1.34.0b1; sys_platform != "win32"',
5960
'packaging>=20.9',
6061
'pkginfo>=1.5.0.1',
6162
# psutil can't install on cygwin: https://github.com/Azure/azure-cli/issues/9399

0 commit comments

Comments
 (0)