Skip to content

Commit

Permalink
Merge remote-tracking branch 'azure/dev' into graph-lab
Browse files Browse the repository at this point in the history
  • Loading branch information
jiasli committed Sep 12, 2024
2 parents 51bdebf + 3ae89ed commit 1818d94
Show file tree
Hide file tree
Showing 16 changed files with 1,876 additions and 778 deletions.
11 changes: 0 additions & 11 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -911,12 +911,6 @@ jobs:
pool: ${{ arch.pool }}

# https://wiki.debian.org/DebianReleases
Buster ${{ arch.name }}:
# 10
deb_system: debian
distro: buster
arch: ${{ arch.value }}
pool: ${{ arch.pool }}
Bullseye ${{ arch.name }}:
# 11
deb_system: debian
Expand Down Expand Up @@ -975,11 +969,6 @@ jobs:
distro: noble
arch: ${{ arch.value }}
pool: ${{ arch.pool }}
Buster ${{ arch.name }}:
deb_system: debian
distro: buster
arch: ${{ arch.value }}
pool: ${{ arch.pool }}
Bullseye ${{ arch.name }}:
deb_system: debian
distro: bullseye
Expand Down
9 changes: 0 additions & 9 deletions src/azure-cli/azure/cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
start_time = timeit.default_timer()

import sys
import uuid

from azure.cli.core import telemetry
from azure.cli.core import get_default_cli
Expand All @@ -21,14 +20,6 @@
__version__ = "2.64.0"


# A workaround for https://bugs.python.org/issue32502 (https://github.com/Azure/azure-cli/issues/5184)
# If uuid1 raises ValueError, use uuid4 instead.
try:
uuid.uuid1()
except ValueError:
uuid.uuid1 = uuid.uuid4


logger = get_logger(__name__)


Expand Down
27 changes: 11 additions & 16 deletions src/azure-cli/azure/cli/command_modules/netappfiles/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from knack.log import get_logger
from azure.cli.core.azclierror import ValidationError
from azure.cli.core.aaz import has_value, AAZJsonSelector
from msrestazure.tools import is_valid_resource_id, parse_resource_id
from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id
from .aaz.latest.netappfiles import UpdateNetworkSiblingSet as _UpdateNetworkSiblingSet
from .aaz.latest.netappfiles.account import Create as _AccountCreate, Update as _AccountUpdate
from .aaz.latest.netappfiles.account.ad import Add as _ActiveDirectoryAdd, List as _ActiveDirectoryList, Update as _ActiveDirectoryUpdate
Expand Down Expand Up @@ -332,26 +332,21 @@ def pre_operations(self):
subnet_rg = args.resource_group
subs_id = self.ctx.subscription_id
vnetArg = args.vnet.to_serialized_data()
# determine vnet - supplied value can be name or ARM resource Id
if is_valid_resource_id(vnetArg):
resource_parts = parse_resource_id(vnetArg)
vnetArg = resource_parts['resource_name']
subnet_rg = resource_parts['resource_group']

# determine subnet - supplied value can be name or ARM resource Id
if is_valid_resource_id(args.subnet_id.to_serialized_data()):
resource_parts = parse_resource_id(args.subnet_id.to_serialized_data())
subnet = resource_parts['resource_name']
subnet_rg = resource_parts['resource_group']

args.subnet_id = f"/subscriptions/{subs_id}/resourceGroups/{subnet_rg}/providers/Microsoft.Network/virtualNetworks/{vnetArg}/subnets/{subnet}"
if not is_valid_resource_id(args.subnet_id.to_serialized_data()):
if is_valid_resource_id(vnetArg):
# determine vnet - supplied value can be name or ARM resource Id
resource_parts = parse_resource_id(vnetArg)
vnetArg = resource_parts['resource_name']
subnet_rg = resource_parts['resource_group']
args.subnet_id = f"/subscriptions/{subs_id}/resourceGroups/{subnet_rg}/providers/Microsoft.Network/virtualNetworks/{vnetArg}/subnets/{subnet}"

# if NFSv4 is specified then the export policy must reflect this
# the RP ordinarily only creates a default setting NFSv3.
logger.debug("ANF log: ProtocolTypes rules len:%s", len(args.protocol_types))

for protocl in args.protocol_types:
logger.debug("ANF log: ProtocolType: %s", protocl)
for protocol in args.protocol_types:
logger.debug("ANF log: ProtocolType: %s", protocol)

logger.debug("ANF log: exportPolicy rules len:%s", len(args.export_policy_rules))

Expand Down Expand Up @@ -426,7 +421,7 @@ def pre_operations(self):
class VolumeUpdate(_VolumeUpdate):
@classmethod
def _build_arguments_schema(cls, *args, **kwargs):
from azure.cli.core.aaz import AAZStrArg, AAZIntArgFormat
from azure.cli.core.aaz import AAZIntArgFormat, AAZStrArg
args_schema = super()._build_arguments_schema(*args, **kwargs)
args_schema.vnet = AAZStrArg(
options=["--vnet"],
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def test_create_volume_with_subnet_in_different_rg(self):

subnet_id = "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/virtualNetworks/%s/subnets/%s" % (subs_id, subnet_rg, vnet_name, subnet_name)

volume = self.cmd("az netappfiles volume create --resource-group %s --account-name %s --pool-name %s --volume-name %s -l %s %s --file-path %s --vnet %s --subnet %s" % (rg, account_name, pool_name, volume_name, RG_LOCATION, VOLUME_DEFAULT, file_path, vnet_name, subnet_id)).get_output_in_json()
volume = self.cmd("az netappfiles volume create --resource-group %s --account-name %s --pool-name %s --volume-name %s -l %s %s --file-path %s --subnet %s" % (rg, account_name, pool_name, volume_name, RG_LOCATION, VOLUME_DEFAULT, file_path, subnet_id)).get_output_in_json()
assert volume['name'] == account_name + '/' + pool_name + '/' + volume_name

self.cmd("az netappfiles volume delete --resource-group %s --account-name %s --pool-name %s --volume-name %s --yes" % (rg, account_name, pool_name, volume_name))
Expand Down Expand Up @@ -573,7 +573,7 @@ def test_network_sibling_sets(self):

@serial_test()
@ResourceGroupPreparer(name_prefix='cli_netappfiles_test_volume_', additional_tags={'owner': 'cli_test'})
def test_volumesize8Tib(self):
def test_volume_size_8Tib(self):
# tests that adding export policy works with non-default service level/usage threshold
account_name = self.create_random_name(prefix='cli-acc-', length=24)
pool_name = self.create_random_name(prefix='cli-pool-', length=24)
Expand All @@ -586,3 +586,19 @@ def test_volumesize8Tib(self):
# check the specified volume properties
assert volume['usageThreshold'] == 8192 * GIB_SCALE
assert volume['serviceLevel'] == "Standard"

@serial_test()
@ResourceGroupPreparer(name_prefix='cli_netappfiles_test_volume_', additional_tags={'owner': 'cli_test'})
def test_volume_size_50Gib(self):
# tests that adding export policy works with non-default service level/usage threshold
account_name = self.create_random_name(prefix='cli-acc-', length=24)
pool_name = self.create_random_name(prefix='cli-pool-', length=24)
volume_name = self.create_random_name(prefix='cli-vol-', length=24)
pool_payload = "--service-level 'Standard' --size 8"
volume_payload = "--service-level 'Standard' --usage-threshold 50"

volume = self.create_volume(account_name, pool_name, volume_name, '{rg}', pool_payload=pool_payload, volume_payload=volume_payload)
assert volume['name'] == account_name + '/' + pool_name + '/' + volume_name
# check the specified volume properties
# assert volume['usageThreshold'] == 8192 * GIB_SCALE
assert volume['serviceLevel'] == "Standard"
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _getattr(obj, attr):

# Command validators
def validate_resync_quotarule(cmd, namespace):
from msrestazure.tools import parse_resource_id, is_valid_resource_id
from azure.mgmt.core.tools import parse_resource_id, is_valid_resource_id
# Get volume params
netAppVolumeClient = volumes_mgmt_client_factory(cmd.cli_ctx, None)
netAppVolumeQuotaRuleClient = volume_quota_rules_mgmt_client_factory(cmd.cli_ctx, None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'identifier_uris': 'identifierUris',
'is_fallback_public_client': 'isFallbackPublicClient',
'sign_in_audience': 'signInAudience',
'service_management_reference': 'serviceManagementReference',
'key_credentials': 'keyCredentials',
# web
'web_home_page_url': ['web', 'homePageUrl'],
Expand Down
3 changes: 3 additions & 0 deletions src/azure-cli/azure/cli/command_modules/role/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def load_arguments(self, _):
help="Specifies the fallback application type as public client, such as an installed application "
"running on a mobile device. The default value is false which means the fallback application "
"type is confidential client such as a web app.")
c.argument('service_management_reference',
help='References application or service contact information from a Service or Asset Management '
'database.')
c.argument('sign_in_audience',
arg_type=get_enum_type(['AzureADMyOrg', 'AzureADMultipleOrgs', 'AzureADandPersonalMicrosoftAccount',
'PersonalMicrosoftAccount']),
Expand Down
24 changes: 17 additions & 7 deletions src/azure-cli/azure/cli/command_modules/role/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,9 @@ def _resolve_role_id(role, scope, definitions_client):


def create_application(cmd, client, display_name, identifier_uris=None,
is_fallback_public_client=None, sign_in_audience=None,
is_fallback_public_client=None,
service_management_reference=None,
sign_in_audience=None,
# keyCredentials
key_value=None, key_type=None, key_usage=None, start_date=None, end_date=None,
key_display_name=None,
Expand All @@ -655,7 +657,9 @@ def create_application(cmd, client, display_name, identifier_uris=None,
existing_apps[0][ID])
body = update_application(
existing_apps[0], display_name=display_name, identifier_uris=identifier_uris,
is_fallback_public_client=is_fallback_public_client, sign_in_audience=sign_in_audience,
is_fallback_public_client=is_fallback_public_client,
service_management_reference=service_management_reference,
sign_in_audience=sign_in_audience,
# keyCredentials
key_value=key_value, key_type=key_type, key_usage=key_usage,
start_date=start_date, end_date=end_date,
Expand All @@ -670,9 +674,9 @@ def create_application(cmd, client, display_name, identifier_uris=None,
app_roles=app_roles,
optional_claims=optional_claims,
required_resource_accesses=required_resource_accesses)
patch_application(cmd, existing_apps[0][ID], body)

# no need to resolve identifierUris or appId. Just use id.
# No need to resolve identifierUris or appId. Just use object id.
client.application_update(existing_apps[0][ID], body)
return client.application_get(existing_apps[0][ID])

# identifierUris is no longer required, compared to AD Graph
Expand All @@ -684,7 +688,9 @@ def create_application(cmd, client, display_name, identifier_uris=None,

_set_application_properties(
body, display_name=display_name, identifier_uris=identifier_uris,
is_fallback_public_client=is_fallback_public_client, sign_in_audience=sign_in_audience,
is_fallback_public_client=is_fallback_public_client,
service_management_reference=service_management_reference,
sign_in_audience=sign_in_audience,
# keyCredentials
key_credentials=key_credentials,
# web
Expand All @@ -709,7 +715,9 @@ def create_application(cmd, client, display_name, identifier_uris=None,


def update_application(instance, display_name=None, identifier_uris=None, # pylint: disable=unused-argument
is_fallback_public_client=None, sign_in_audience=None,
is_fallback_public_client=None,
service_management_reference=None,
sign_in_audience=None,
# keyCredentials
key_value=None, key_type=None, key_usage=None, start_date=None, end_date=None,
key_display_name=None,
Expand All @@ -730,7 +738,9 @@ def update_application(instance, display_name=None, identifier_uris=None, # pyl

_set_application_properties(
body, display_name=display_name, identifier_uris=identifier_uris,
is_fallback_public_client=is_fallback_public_client, sign_in_audience=sign_in_audience,
is_fallback_public_client=is_fallback_public_client,
service_management_reference=service_management_reference,
sign_in_audience=sign_in_audience,
# keyCredentials
key_credentials=key_credentials,
# web
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ ad app create:
public_client_redirect_uris:
rule_exclusions:
- option_length_too_long
service_management_reference:
rule_exclusions:
- option_length_too_long
ad app update:
parameters:
enable_access_token_issuance:
Expand All @@ -29,6 +32,9 @@ ad app update:
public_client_redirect_uris:
rule_exclusions:
- option_length_too_long
service_management_reference:
rule_exclusions:
- option_length_too_long
ad user create:
parameters:
force_change_password_next_sign_in:
Expand Down
Loading

0 comments on commit 1818d94

Please sign in to comment.