create security integration external_oauth_azure_lenovotest
type = external_oauth
enabled = true
external_oauth_type = azure
external_oauth_issuer = 'https://sts.windows.net/45645719-5ecc-4689-b5bf-43cdc0868980/'
external_oauth_jws_keys_url = 'https://login.microsoftonline.com/45645719-5ecc-4689-b5bf-43cdc0868980/discovery/v2.0/keys'
external_oauth_token_user_mapping_claim = 'upn'
external_oauth_audience_list = ('https://232c7069-8cd6-4979-92b7-e723256a9d45')
external_oauth_snowflake_user_mapping_attribute = 'login_name EMAIL_ADDRESS'
external_oauth_any_role_mode = 'ENABLE'
https://login.microsoftonline.com/5c7d0b28-bdf8-410c-aa93-4df372b16203/discovery/v2.0/keys
https://sts.windows.net/5c7d0b28-bdf8-410c-aa93-4df372b16203
desc integration external_oauth_azure
select current_user("abc@")
del integration external_oauth_azure
alter security integration external_oauth_azure_lenovotest set external_oauth_snowflake_user_mapping_attribute = 'login_name'
select system$verify_external_oauth_token('eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Im5PbzNaRHJPRFhFSzFqS1doWHNsSFJfS1hFZyIsImtpZCI6Im5PbzNaRHJPRFhFSzFqS1doWHNsSFJfS1hFZyJ9.eyJhdWQiOiJodHRwczovLzRiNmJiNmY0LWFiZTYtNDg5Ny1iMDZmLTA0ZDk2ZDdiZjM0MiIsImlzcyI6Imh0dHBzOi8vc3RzLndpbmRvd3MubmV0LzVjN2QwYjI4LWJkZjgtNDEwYy1hYTkzLTRkZjM3MmIxNjIwMy8iLCJpYXQiOjE2MjcyNjE0MzQsIm5iZiI6MTYyNzI2MTQzNCwiZXhwIjoxNjI3MjY1MzM0LCJhY3IiOiIxIiwiYWlvIjoiRTJaZ1lLajczSGYxVnI1Vm1UTjM2RUxweU1XTURlbnM3RHZESnpiVXFYN2EwYk9sY2lrQSIsImFtciI6WyJ3aWEiXSwiYXBwaWQiOiI0YjZiYjZmNC1hYmU2LTQ4OTctYjA2Zi0wNGQ5NmQ3YmYzNDIiLCJhcHBpZGFjciI6IjE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