lib/fog/azurerm/utilities/general.rb in gitlab-fog-azure-rm-2.1.0 vs lib/fog/azurerm/utilities/general.rb in gitlab-fog-azure-rm-2.2.0

- old
+ new

@@ -87,9 +87,31 @@ else '.core.windows.net' end end + # Per https://learn.microsoft.com/en-us/azure/storage/blobs/authorize-access-azure-active-directory, + # all endpoints use the same resource URL. + def storage_resource(_environment = ENVIRONMENT_AZURE_CLOUD) + 'https://storage.azure.com' + end + + # https://learn.microsoft.com/en-us/entra/identity-platform/authentication-national-cloud#microsoft-entra-authentication-endpoints + def authority_url(environment = ENVIRONMENT_AZURE_CLOUD) + case environment + when ENVIRONMENT_AZURE_CHINA_CLOUD + 'https://login.chinacloudapi.cn' + when ENVIRONMENT_AZURE_US_GOVERNMENT + 'https://login.microsoftonline.us' + # This region is deprecated: + # https://learn.microsoft.com/en-us/entra/identity-platform/authentication-national-cloud#azure-germany-microsoft-cloud-deutschland + when ENVIRONMENT_AZURE_GERMAN_CLOUD + 'https://login.microsoftonline.de' + else + 'https://login.microsoftonline.com' + end + end + def get_blob_endpoint(storage_account_name, enable_https = false, environment = ENVIRONMENT_AZURE_CLOUD) protocol = enable_https ? 'https' : 'http' "#{protocol}://#{storage_account_name}.blob#{storage_endpoint_suffix(environment)}" end