in packages/autorest.python/autorest/m4reformatter/__init__.py [0:0]
def get_credential_scopes_from_flags(self, auth_policy: str) -> List[str]:
if self.azure_arm:
return ["https://management.azure.com/.default"]
credential_scopes_temp = self._autorestapi.get_value("credential-scopes")
credential_scopes = credential_scopes_temp.split(",") if credential_scopes_temp else None
if self._autorestapi.get_boolean_value("credential-scopes", False) and not credential_scopes:
raise ValueError(
"--credential-scopes takes a list of scopes in comma separated format. "
"For example: --credential-scopes=https://cognitiveservices.azure.com/.default"
)
if not credential_scopes:
_LOGGER.warning(
"You have default credential policy %s "
"but not the --credential-scopes flag set while generating non-management plane code. "
"This is not recommend because it forces the customer to pass credential scopes "
"through kwargs if they want to authenticate.",
auth_policy,
)
credential_scopes = []
return credential_scopes